-
Notifications
You must be signed in to change notification settings - Fork 1
Conductor (Unity API)
To use Stepwise in your Unity project, at a minumum you'll need to add the Conductor component to a game object. It allows you to load stories, and contains the Score object, the brains of the currently loaded story.
Property | Type | Description |
---|---|---|
dataFile | TextAsset | If you drag a TextAsset into this property slot in the Conductor's inspector, the Conductor will attempt to load it automatically on startup. |
score | Score | Manages execution of the currently loaded story. |
Attempts to load the given text file as a Stepwise script. The file's contents will first be parsed as Stepwise XML, and if that fails, then as a plain text file where line breaks are used to delimit steps.
Attempts to load the given string as a Stepwise script. The string will first be parsed as Stepwise XML, and if that fails, then as a plain text file where line breaks are used to delimit steps.
Resets the current story to a pristine state.
Executes the next step in the current sequence of the current story. This may result in more than one actual step being executed. Subscribe to the Step.OnStepExecuted event to be notified as each step occurs.
This event is called when the Conductor begins loading a new script into its Score. You can subscribe to this event as follows:
void Start() {
Conductor.OnScoreLoad += HandleScoreLoading
}
public virtual void HandleScoreLoading(Conductor conductor) {
// attempting to load a new script into the score
}
This event is called when a new script has successfully been loaded into the Score. You can subscribe to this event as follows:
void Start() {
Conductor.OnScorePrepared += HandleScorePrepared
}
public virtual void HandleScorePrepared(Score score) {
// a new script has been loaded into the score
}