Hello, I realize there have been quite a lot of posts on inventory systems, but I just can’t wrap my head around the solution, in the context of what I am trying to achieve. That being said, I’m doing this to better my understanding of programming as I’m a beginner in unity (and coding in general), so providing as much information as you’re willing to type up is something I’m appreciative of. I’m really looking to understand the concept behind creating an inventory (and generally, just storing data) so I can figure out different methods of creating them myself, as well as twist and turn other methods. I’ll show you what I have so far to better communicate the question I am asking.
switch (Input.inputString) {
//Can't figure out how to add items to the selected slots
case "1":
selectedSlot = eqSlots.hands;
break;
case "2":
selectedSlot = eqSlots.leftArm;
break;
...
case "7":
selectedSlot = eqSlots.rightBack;
break;
}
So, here I have something to select which slot on the player is currently active.
switch (selectedItem){
//Do something based on which item is equipped
case tools.hands:
break;
case tools.weapon:
break;
case tools.hammer:
break;
case tools.crucible:
break;
case tools.hoe:
break;
case tools.ingot:
break;
}
And here I have something on a different game object that will decide what to do based on which item is selected in the slot. But the actual problem is, I don’t have any way to actually store the item that is selected (which I want to be a game object). I really feel like the solution is on the tip of my fingers, but I’m missing something. Hence my question, can one of you smart gurus school me on how to store and access specific game objects effectively?