- Home /
Item database with custom editor
I have to store information about the items in my game, such as name, weight and so on. To keep it easily editable, I opted to do this through a custom editor in the inspector. It uses a list of classes (Weapon, Armor, etc) derived from a basic Item class.
Originally I made the Item class inherit from ScriptableObject, but then I found out that ScriptableObjects only persist throughout the current scene, so the data is lost when I copy the DB object onto a new scene.
But if I don't use ScriptableObject, the item list can't keep the derived classes when serialized and stores everything as the base class, Item.
Storing these values in the item GO's themself is not ideal.
What other options do I have to do this?
Globally accessible item list (from any scene)
Easily editable
Each item contains at least: some ints, some strings, a reference to a prefab GO and another reference to a (inventory) texture.
Different variables based on the inherited classes (multiple levels).
I'm not asking to write it for me, just to point me in the right direction.
If all else fails, I'm considering just putting the values as constants in a script/txt/xml and adding to that for each new item. Is this a bad idea? (besides the obvious arduous editing)
I'm very curious to hear if you've been able to answer your own question and if so what you chose to do in the end.
I think scriptable objects should work fine for this, but I'm puzzled by your comment that "ScriptableObjects only persist throughout the current scene" -- an instance of a scriptable object is normally an asset that lives "forever" in your Assets folder. How exactly are you using your scriptable objects?
Your answer
Follow this Question
Related Questions
How do I retrieve an item from a list? 1 Answer
How to create complex item system in an elegant way 0 Answers
Custom Editor showing a List as a dropdown Menu ? 2 Answers
Keeping item database 1 Answer
Weird issue with List and for loop. 1 Answer