- Home /
Custom Editor Window to Create and Store Item Data
I want to create an Editor Window that I can use to Create, Store, Display and Edit Items for my game. Sort of like an Item Database Window.
My question is: Is what is the theory behind setting something like this up? Should I be writing all this information from this Editor Window into a txt files and calling it out at runtime into a Dictionary or List for use in the game?
I can write the editor window that's not the issue. I just need to know how to store the data for use later. What are some approaches I could take?
Were you able to create the custom editor for this particular problem. If so, are you willing to elaborate some more on the code involved?
Basically you create a ScriptableObject class that contains arrays of all your object data. Then populate that with an editor script that adds new entries into the arrays. Then when you done you have a save function that saves out the asset. That asset can then be loaded from any script and read for data.
I ended up using external files that I fill with data and have the game read on start up. This way I can format and edit anyway I need. It turned out to be much easier for the time being and require less changes as I iterate.
Here is a good topic on it all: http://ivanozanchetta.com/gamedev/unity3d/unity-serialization-behind-scriptableobject/
Answer by whydoidoit · Jul 20, 2012 at 06:21 PM
You could create a class from ScriptableObject and store it as an asset, that's probably the most elegant way. Then you can use the inspector to assign the data as well.
Thank you. Would I be correct to assume this generated asset would act like a prepopulated class containing all the item information as if I had done it all by hand in the script editor?
Yes, it becomes an asset so when you've configured it the data will be saved.
Your answer
![](https://koobas.hobune.stream/wayback/20220613074454im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Good way to store Items in a mySQL database? 2 Answers
How do I retrieve an item from a list? 1 Answer
Item Database 3 Answers
Store item images in database or on device? 0 Answers
DontDestroyOnLoad make errors 0 Answers