Chapter 9: Story API – Observing and Reacting to Story Events
In this chapter, we will explore how changes in a running ink story can trigger events in Unity. We will learn how the ObserveVariable()
and ObserveVariables()
methods of the Story API, as provided by the ink-Unity Integration plugin, allow you to prepare functions to react to future events in Unity. We will begin by observing a single variable and then move on to learn how to watch multiple values.
In Chapter 8, Story API – Accessing ink Variables and Functions, the focus was on controlling an ink story by calling its functions and changing its values from Unity. This chapter reverses the emphasis between the two systems. In this chapter, we will explore how narrative events, such as variables changing because of a player's choices, can be used to control what information is presented in Unity.
In this chapter, we will cover the following topics:
- Listening for variable changes
- Dynamically...