-
Notifications
You must be signed in to change notification settings - Fork 1
Getting started with Stepwise for Unity
First, install the Stepwise for Unity package, located in this repository at src/Unity/StepwiseForUnity_[version num].unitypackage.
To use Stepwise in your Unity project, at a minimum you'll need to add the Conductor component to a game object in your scene. The Conductor component includes a slot for a TextAsset—if you drop a plain text file or Stepwise XML file into that slot, the Conductor will load it automatically when the scene starts. The HelloWorld scene includes an example of this usage.
This very simple implementation of Stepwise includes a Stepwise game object with a Conductor component that is pre-filled with a simple Stepwise XML "Hello World" script. The script will be loaded automatically when the scene starts. You can also leave the Data File slot empty and load a script from code, in either plain text or Stepwise XML formats, using the Conductor object's Load methods.
That same game object also includes a StepLogger component which updates two fields in the scene's Canvas object to indicate the current status of the story and its output. Check the source code of the StepLogger to see how to subscribe to important Stepwise events like OnScoreLoading, OnScorePrepared, and most important, OnStepExecuted.
The SheetToCanvas scene demonstrates loading Stepwise content from a Google Sheets document using the SheetsLoader component.
In addition, the scene includes a Canvas Writer component that parses Stepwise steps into a 2D presentation using a Unity UI Canvas, with options similar to those available in the ScreenSplitter stage on the Stepworks website (click the "Technical Notes" link on the page for the stage to get a sense of available commands--though not all are supported). In this way a Google Sheets document can be used to choreograph the layout of multiple 2D panels in the UI Canvas containing text, images, and video.
Note that the SheetsLoader component doesn't have to be used with the CanvasWriter--it can be used anywhere you want to use Google Sheets content to power a Stepwise instance.
The StepworksCatalog scene interfaces with Stepworks (http://step.works), a website where users can create their own Stepwise stories, and where a catalog of existing stories is hosted.
The StepworksCatalog component loads the current library of stories hosted on Stepworks. Clicking on a story loads it into the scene's instance of Stepwise and starts it running.
Many of the Stepworks stories contain features which are too complex for this simple player to properly handle; multiple characters, images, video, and audio, musical notes, etc. Taken together, they make use of most of the full range of what's possible in Stepwise. When you're creating your own Stepwise clients, how you want to support those features is up to you. Exploring the "Browse" section of the Stepworks website will give you a sense of how some of these features might be supported.
In addition, the StepworksCatalog scene includes a plain text input option, to demonstrate how users can create their own simple stories. At present, the plain text parser can only create simple linear looping stories, but this may be expanded in future.