Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Can / Should ScriptableObjects be used to store character data?

I’m working on a turn based RPG and wanted to know whether its a good idea to use ScriptableObjects as a way to store character data that will change at one point or another at runtime like stats, inventory items, spells & abilities, etc. I know that ScriptableObjects are usually predefined and are used as read-only, so I wanted to ask around before I committed to it.

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

ScriptableObjects Are great for storing data at runtime, but if you want data to persist between sessions of your game, you’re going to want to write the data to a file.

Application.persistentDataPath can be used to get a path to a place where you can save game data in files. You can then create a file and save your data in json format.

This would allow you to modify your scriptable objects at runtime, then when it comes to saving the game, convert them to json text and store your data in a text file.

Then when you open your game up again you can read this file and re-apply the data to your scriptable objects.

Just make sure all of your data is serialisable and it will work just fine.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading