How to control class variables from an Editor Tool or external file?

So I have been scratching my head a bunch on this issue I’m having…

Basically, I have a class called “BikeUpgrades” which does not extend MonoBehavior. That class has all the base values for each upgrade defined in it.

Now I would like to be able to change those values from either an Editor Tool, or an external file, because I don’t want to have to open my BikeUpgrades class just to change some default values, I would rather be able to change them from somewhere else.

Let’s say there were 3 other ppl working on my project, and they need access to those base values in order to tweak upgrade settings, but I don’t want them to mess around in the code, so I would write an editor script that they can use, which updates the base values defined in the BikeUpgrades class. Or maybe I give them an external .ini or .json file that they can edit to change the base values of the BikeUpgrades class.

What would be the best way to do that? I really like the idea of using an editor script, but I do not have the PRO License for Unity so I can’t use Asset Bundles (if I did, I would have the editor script save those values in an Asset Bundle).

Any help/tips will be greatly appreciated! As always, thanks for your time :slight_smile:
Stephane

There are several ways to do this. These are the ones I already tried out and that worked:

  1. Instead of a static class use a singleton MonoBehaviour. Make a prefab of that and now you can change the values directly on the prefab.
  2. Write a custom editor/inspector script that exposes static members. (This is possible using reflection but not the easiest thing to do)
  3. Use a text based format of your (and your colleagues) liking. Store this in Resources and parse it at runtime.

We tried several formats (xml,json,csv), each has advantages and disadvantages. At the moment we are using a solution that uses Google spreadsheets which are auto-converted to csv or json depending on the content.

I’d put them into the Resources folder and load them as TextAsset with Resources.Load(“MyFile”, typeof(TextAsset));