Remembering how to Make a Game Manager


Author: Marie Halper

Posted on 5/24/2024

This week, I focused on getting the win and lose conditions working in Trading Card Dungeon. Of course, working with Unity, this involved the creation of the GameManager script. It had been a little while since I last worked in the engine, so to say I was a bit rusty is an understatement. It took me a solid day of looking back at previous projects to remember how to actually make code work. The first thing that clicked in my memory is having the all important GameManager script, so I made it, and got to work on what was needed, what was included in the script besides variables and general use methods was beyond me, until I tried to reference the instance in another script, and was shocked when I got a face full of errors. 

After a bit of back and fourth, referencing some old projects, I remembered a crucial line of code near the top of the script,  "Instance = this;" After a solid hour of checking for things within methods I forgot to do, or setting variables in Unity itself, it all came back to this one small line, I added it to the script, and like magic, my buttons started working, my inputs were responsive, all was right in the world once more!


It just goes to show, no matter how skilled you are, or how much reference material you have. Sometimes all you need to do to solve an issue, is to look closely at the Start method, you never know what is written in it.

Leave a comment

Log in with itch.io to leave a comment.