Summary
We created our first real scripts in this chapter, which provide useful behavior. We discussed how to move a GameObject based on input and instantiate Prefabs via scripting, creating objects at will according to the game situation. Also, we saw how to schedule actions—in this case, spawning—but this can be used to schedule anything. We saw how to destroy created objects to avoid increasing the number of objects to an unmanageable level. Finally, we explored the new Input System to provide maximum flexibility to customize our game’s input. We will use these actions to create other kinds of objects, such as sounds and effects, later in this book.
Now, you are able to create any type of movement or spawning logic that your objects will need, and you can make sure those objects are destroyed when needed. You might think that all games move and create shooting systems in the same way, and while they are similar, being able to create your own movement and...