Custom Resource Editor

Hi,

For my current project I have created a “Resource Editor”, this so that I can easily create new ScriptableObjects and use them in the game. The reason is that I wanted a place where I can see them all at once and easily make changes (like a data table). I then save all the objects to the same asset file in a list and load the list on game start.

This all works very well and the Objects can reference each other by name, I currently use custom drawers to make sure the names will always match. All ScriptableObjects need to have unique names in my case.

Is there any way to serialize references to ScriptableObjects by getting the fileID and guid ? Or let the editor know about my ScriptableObjects inside my list ? This so I would not need to make Custom Drawers for everything ?

Another issues that I’m having is the need to make clones of all the ScriptableObject when starting the game, this so that I don’t change the original files by accident. I have tried looking for something like ‘const’ in C++ but only thing I found for C# was making the list readonly however the ScriptableObjects inside the list can still be changed. I’m super scared of the bugs this might cause in the future.
Have someone found a good solution to this issue ?

For the cloning issue, you could wrap the cloning in an #if UNITY_EDITOR block. That’ll guard against the problem in the editor, and not incur the performance cost in builds.

For serialization - you can serialize references to ScriptableObject instances in the exact same way you serialize references to any other asset. A [SerializeField] variable referencing a ScriptableObject will work.