Observing multiple ink values
Along with the ObserveVariable()
method is a sister method named ObserveVariables()
. However, while the ObserveVariable()
method accepts the name of a variable and a delegate function, the ObserveVariables()
method accepts an IList<string>
of variable names and a delegate function. Instead of responding when a single variable is changed, its delegate function is called when any of the variables passed as a list to the method are changed. While slightly more complicated to set up, the ObserveVariables()
method provides the functionality to observe multiple ink variables.
Recommendation
It is recommended that you create a new Unity 2D project for this section. Instructions regarding how to create a new Unity project and import the ink-Unity Integration plugin can be found in Chapter 6, Adding and Working with the ink-Unity Integration Plugin.
Perform the following steps:
- In a new Unity 2D project with the ink-Unity Integration plugin...