Setting Up An Item Store. Need help with conceptualizing how to save information.

We want to create a custom editor and we’re conceptualizing how to approach this. We don’t need code. Just a helping mind.

Essentially once we open up the custom editor, we have the option of adding the following information:

Item Name:
Item Description:
Item Cost:
Item Resale Cost:
Item Devaluation Percentage:
Item Devaluation Percentage (per use):
Strength:
Defense:
Dexterity:
Intelligence:
Luck:

Once we enter the information we want for each item, the information should automatically be saved. However we don’t have any clue on how to save that information. What is the best way to go about it? Would we save it to an array that kept track of each piece of information? Would we use multiple arrays?

An example being: array potion (potion.item, potion,description, etc)

First of all, don’t use an Editor.

An editor is designed to be used with monobehaviours, which in turn are designed to be assigned to game objects. Editors customize properties of behaviours that are designed to be unique to that object.

What you want to use is an editor window similar to the window that pops up when you want to bake lightmapping data or change render settings. In the editor window, define an array, Item[ ] to edit. Define all your editing controls inside the editor window and when you’re done editing the Item[ ] array, save it using System.Serialization.Formatters.BinaryFormatters. Give the saved file an extension of “.bytes” and save it to your Resources folder. Now you can access it dynamically, in code by using Resources.Load()!

An alternative solution would be to create prefabs of every weapon and attach an Item script to each prefab. Then you could put all the prefabs in the resources folder, load them on game start up and populate your store’s array with the prefab data. This second method might be more in-sync with how the folks at Unity designed the behaviour system.

I love you! Thank you! Seriously mate!

We’re going to try working this out!

You could just create a class array for the inspector. Save you lots of time and effort for what your trying to do.
You can then later create a cool editor script that reads the array for editing or display.

I just created a sweet inventory system with store/merchant , bank spell/item bar ect. so all the know how is still fresh if you need help.
My system can be found in the asset store. Sneak Peek