Postmortem: My Second Finished Unity Game
I finally finished The Ghastly Guesser last weekend and posted it on Itch. In case you’re wondering, Itch is an online gaming platform that’s similar to Steam. It’s a great place for developers new and experienced alike to share their work.
I never did a postmortem for my first game, which I now regret. At the time I was just so relieved to be done that I didn’t spend the time writing down my thoughts. Now that The Ghastly Guesser is live I’m ready to reflect on the good and the bad in my project.
I became a lot more comfortable reducing dependencies between scripts in this project. In my first game I spent too much time fetching variables from other classes when I could have just done a better job at organizing my method calls.
I used cached references at the top of each class more effectively too. So now I was able to fetch a component in the Start() method, store that variable, then use it again in another method in the same class. As a beginner, I used to keep fetching/redefining my variables over and over again without caching them-- a huge waste of time!
In this project I also became more comfortable reusing code. I now have several projects that I can pull code from and adapt it to serve my needs. For example, I was able to reuse the singleton pattern in my MusicPlayer class from another project I worked on in the summer.
This was my first time using input fields and I saw how useful they are. It took me a long time to figure out that I could make the string variable static and pass it to the next scene. I’d done something similar in a previous demo I’d worked on but I wasn’t used to working with a string inputted by the user.
I still can’t quite get the hang of sorting layers in Unity. In this game I worked with many different sprites and I wanted to have UI elements such as text boxes appear on top of them. This wasn’t easy to accomplish without fiddling around with extra canvas components. I had an explosion sprite ready to add to the ghost animation but I couldn’t get it to instantiate on top of the ghost sprite. Sorting layers is something I must work on!
I’m still working on being more comfortable with the get:set pattern in C#. I use Get() methods fairly often, but setting still gives me trouble. Hopefully I will get to work on that more in the RPG demo I am slowly building. The same goes for coroutines, which are a big part of working with C# in Unity. Although I use them more often now, I still think my code could be tightened up, especially when I attempt to nest the coroutines.
I'm still sometimes hardbaking values instead of using variables to set them. Ah yes, one of the most common mistakes any programmer makes in their code. I’m guilty of hardbaking values larger than 1 when I’m testing the code and then forgetting to go back and replace them with serialized variables.
I started The Ghastly Guesser thinking it would be a quick tutorial project that I could showcase on my portfolio. It ended up taking me a lot longer than I had planned to build, but I'm pretty happy with the results. I feel more confident each time I try to build a project myself instead of just following along with a tutorial. It's gratifying to see my imagination come to life via code and I can't wait to see what I come up with next.
Thanks for reading!