Controlling a story through variables and functions
The variablesState
property and the EvaluateFunction()
method give the developer two ways in which to access values within an ink story. By using these two approaches, a story can be controlled by more than just the options that are presented to a player. User interface elements within Unity can be attached to methods that can then change ink values.
In this section, we will connect ink to Unity. By using the variablesState
property and the EvaluateFunction()
method, we will review a code pattern where Unity provides the user interface and communicates with ink functions to adjust and react to values during runtime.
Across the three sections of this topic, first, we will prepare a Unity project by creating the necessary game objects. Next, we will add the code to control the user interface. Finally, we will adjust the presentation of the user interface and run the project.
Preparing a user interface
To begin work with...