Creating scripts
The first step to creating behavior is to create script assets; these are files that will contain the logic behind the behavior of our components. Both C# and Visual Scripting have their own type of asset to achieve that, so let’s explore how to do that in both tools.
Having some programming knowledge is required in this book. However, in this first section, we are going to discuss a basic script structure to make sure you have a strong foundation to follow when we code the behaviors of our game in the following chapters. Even if you are familiar with C#, try not to skip this section because we will cover Unity-specific structures of the code.
In this section, we will examine the following script creation concepts:
- Initial setup
- Creating a C# script
- Adding fields
- Creating a Visual Script graph
We are going to create our first script, which will serve to create our component, discussing the tools needed to do so...