Moddable Scriptable Objects

Can scriptable objects be modified by a user or modder, or new ones be created after the build process?

Requirement: The modding will happen after the game “Build” process. With the files available in the client.

How can i design a moddable game in unity to support this ?

  1. Will the user need the entire game source code ?
  2. Are scriptable objects stored somewhere in the unity “data” folder in the build. Is it in readable format ?. Can i append new scriptable objects by adding new files in that location ?
  3. Any working code example is welcome, dropping a single line as answer, and expecting me to figure it out, wont work.
  4. Details: i don’t need to add complex stuff like custom scenes, models, custom code. I just need to append “data” like scriptable objects. If this is not possible with unity architecture. How do i design the system to use something other than scriptable objects, eg database, excel files, etc.

After a quick search I found out this answer to another question that I think applies to your situation.

In short, no scriptable objects are not modable/modifiable outside the UnityEditor. You cannot modify a scriptable object after the build, so you’d need to use regular C# serialization if you want to save/import new data to your game after the build.

While the ScriptableObjects themselves can’t be modified, the solution would be to serialize the ScriptableObject data to disk from the editor. Then, at runtime, you’d deserialize that data back into the ScriptableObject. From there, it’s a simple matter of checking your modding directory at runtime and deserializing any new files from there first. Any files that don’t have a modded equivalent can then just be loaded from their original copy.