Unity has a feature called Scriptable Objects. Scriptable Objects are asset files stored in the Assets folder, like any other asset (such as Materials or Textures). In some ways, Scriptable Objects are like Monobehaviours, but they are not attached to GameObjects. Both logic (code) and data can be stored as asset files in the form of Scriptable Objects.
In this recipe, we implement a state-based game where the game starts in a game-playing state, and goes to a game-lost state when a timer runs out. If two stars are collected before the timer runs out, the game goes into the game-won state. A UI Button is offered to the user, which collects a star each time it is clicked.
As you'll see, Scriptable Object asset files are used to represent which decisions cause which state changes to take place.
...