In this chapter, we implemented a simple, but functional, replay system by using the Command pattern. Our goal with this chapter was not to show how to build a robust replay system, but instead showcase how to use the Command pattern to create something in Unity that might be useful for a game project.
I hope you will research alternative ways of implementing the Command pattern that might be better than shown in this book because, like most things in programming, there is no single way of doing things. Nevertheless, at least this chapter offers a first approach to using the Command pattern with Unity.
In the next part of the book, we will start optimizing our code with the Object pool. An essential aspect of a good racing game is consistent performance and frame rate. Everything must run smoothly at every moment, or it might cause our game to feel slow and sluggish.