Key Item Pickup, Inventory and Door Open v2 scripts
We needed to sort out some kind of inventory system so that the player could find objects and pick up key items. I tried for a ling time to create my own script but after many failed attempts I was able to find an inventory system script on the unity asset store.
After doing some setting up I was able to treat this circle as a ‘key object’. When E is pressed the object is destroyed and a global Boolean variable is flipped which allows the player to open the main door.
You can also hold down the tab button to display the inventory, I created this key sprite so you can identify when you have the key or not.
The code is far too long for me to post here (you can download it + the assets pack here: http://www.mediafire.com/download/w9p98xrg2u9j5tt/InventoryScripts+Assets.zip) but after editing the code and applying it to my door script I was able to create this message that is displayed when you get close to the door without a key.














