Using events and instructions
Now that we have a script, we are ready to do something with it. We won’t implement anything useful in this chapter, but we will settle the base concepts to add interesting behavior to the scripts we are going to create in the next chapters.
In this section, we are going to cover the following concepts:
- Events and instructions in C#
- Events and instructions in visual scripting
- Using fields in instructions
We are going to explore the Unity Event System, which will allow us to respond to different situations by executing instructions. These instructions will also be affected by the value of the editor. Finally, we are going to discuss common scripting errors and how to solve them. Let’s start by introducing the concept of UnityEvents in C#.
Events and instructions in C#
Unity allows us to create behavior in a cause-effect fashion, which is usually called an event system. An event is a situation that...