Unity make ScriptableObject on a build

1.6k views Asked by At

I'm new to scriptable objects, but I've seen a lot of tutorials using them for an inventory system and recipes. My question is if it is possible for a future player of my game to create new "recipes" in the final build that will be saved as scriptable objects. Similar in Minecraft where you can use data packs to create new recipes.

1

There are 1 answers

0
Ted Bigham On BEST ANSWER

ScriptableObjects aren't really intended to be used that way. They are assets in your build, just like objects saved in your scenes during edit time.

One option could be to try to save them as Addressables or AssetBundles so the game could load them dynamically. I don't think any of those facilities are available at runtime, so you would have to jump through a lot of hoops to get the storage format correct. I'd recommend against that and just use regular object serialization to save stuff.

It's worth noting, when you run your game in the editor and directly update your ScriptableObjects at runtime, it will update the asset and will save with the project. Although it might seem like its working, that only works in the editor. In a real build of your game it will not be saved, and will have it's original values every time you start your game (just like the scene objects all return to their original states).