Summary
In this chapter, we created our first real scripts, which provide useful behavior. We discussed how to instantiate Prefabs via scripting, to create 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. Finally, we saw how to destroy created Objects, to prevent increasing the number of Objects to an unmanageable level. We will be using 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 your Objects will need and make sure those Objects are destroyed when needed. You might think that all games move and create shooting systems the same way, but while they are similar, being able to create your own movement and shooting scripts allows you to customize those aspects of the game to behave as intended and create the exact experience you are looking for.
In the next chapter...