This has most likely been asked before, but I couldn’t find the information I wanted from the forum search.
This is more of a question about how to approach a situation than a specific scripting question, but I’m putting this in the scripting section because I will post code examples of what I come up with.
ANYWAYS
I’m at that point in my game where I am trying to implement an inventory system. I got the Inventory Tutorial from some website that has functional “bags” with drag and drop icons, etc. Works great.
My question is this: I am trying to figure out the best way to store item information and use it. I don’t know if I should create a generic item class and create weapons based off that class, in code, and reference it from there. (how would be the best way to do this?)
Or, if I should create a generic “item-class” script with variables exposed in the inspector. This way seems pretty quick, because I can just drag the script on an empty game object and fill in the needed information in the inspector. Also allows for easy tweaking of values.
So what would other people suggest in this situation? How would you approach creating items in your game and then using them?(weapons, potions, etc). I am sure there are a million ways to approach this, so any information from people who have already tackled this subject would be much appreciated.
My initial thought is to create a ‘weapons’ game object, and under that have a list of empty game objects named ‘long_sword’, ‘crossbow’, etc. Then just drag the generic ‘weaponsClass’ script onto the empty game object and fill in the information. Does this sound like a valid way to approach this?
Thanks for your time.