Today has not been a great day.
I have only had about 3 hours to work on the game. I decided I wanted to add in some sort of fuel for the campfire, via a tree asset. Rather than spend a thousand years learning Blender, I went to the asset store, where I found a nice free tree asset to use for now.
I started working on a basic inventory system. I got a bit carried away, and also started refactoring some inefficient code, and tried to get my game objects to be more loosely coupled.
Unfortunately, during my refactoring, I did something that Unity was not expecting, and got this lovely little popup.
My first ever Unity crash, hooray! I lost all of the assets I’d pulled in, I lost the tags I’d created, along with the assignments of those tags to the relevant objects.
I decided to just add in one tree, instead of trying to make things look nice.
Then I spent about 30 minutes trying to figure out why I couldn’t find the script I’d attached to an object, only to realize–after another 20 minutes–that I had accidentally tagged the ground with “Campfire” as well as the actual campfire. Since I was only asking for one object (
FindGameObjectWithTag() instead of
FindGameObjectsWithTag()), I was getting the first one, which was the ground. Removing the tag from the ground worked, and now I feel ridiculous for having spent so long on such a silly problem.
Thankfully, I persevered, and managed to get the tree to be interactive. It adds an item to the inventory, which is not currently a visible component of the game. In the gif below, you can sort of see that the count of items in the inventory increases until it reached the size.
A small win on an otherwise frustrating day.