Today I added some new features to my Walking Simulator. I added an inventory system to pick up and store items, such as the key and the battery. I did this by making 3 new C# scripts, one to make the inventory list, one that is attached to the items so that they disappear and get added to the list, and one that opens the door when the key is picked up. The DoorController searches the inventory for the keyItem (the key) and when it is there, the door rotates open and the key is destroyed. I also added a radio that plays music, and the music gets louder and quieter as you get closer and further away from the radio. I put the model in the rom, made a C# script that adds AudioSource, which is where I attach the music, and I attached this script to the radio GameObject. Finally, I added the highlighter that I didn’t add last week. I lost the feature when I lost my level, so I re-added it, and now you can see the names of various items, e.g. the key, battery, and radio.
I ran into some coding issues, but most were just typos. I also put ‘item’ instead of ‘items’ in one of my scripts, which caused a couple of issues, and lots of accidental colons instead of semi-colons. I had some trouble implementing the highlighter feature, however I asked about it, and realised that I just needed to drag the code onto the GameObject.
My next step is to work out how to toggle the radio on and off. My code is supposed to do this, however for some reason it’s not working. I think it’s either the collision or something I’ve missed in Unity itself. I would also like to make more 3D models to fill the room in my spare time, because it’ll feel more like my own.