Dynamically responding to ink stories
In Unity, multiple methods are called as part of the normal execution cycle when a project runs. Often, methods such as Update()
, a common part of behavior scripts in Unity, include many lines of code. Even a method such as FixedUpdate()
, called at the end of the physics calculations for each cycle in a running project, might include multiple parts. Any code that depends on other systems, such as those communicating with ink, can also add extra time per cycle.
The use of the ObserveVariable()
method allows data from ink to only update Unity when needed. Because the Story API will only call the delegated function when necessary, Unity will also only get the data when there is a change it needs to know about when it needs to know about it. This will also happen outside the use of an Update()
method or even a FixedUpdate()
method in Unity.
In this section, we will examine how the ObserveVariable()
method operates outside of other methods as...