Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by TheGalacticShaman · Jan 31, 2019 at 12:32 PM · scriptableobjectsave dataloading file

Save and (later) read scriptable objects

Hey everyone,

So in my game I currently have a system that creates a bunch of npc stat containers by using "create instance" of a new scriptable object, setting the variables inside to randomized values, and then adding this new SO to a list. This list can contain anywhere between 8 - 16 scriptable objects.

I have been trying to find some documentation about how I can save these new scriptable objects, as they are meant to be generated at runtime and will need to be called between different play sessions but I cant find any helpful information. If anyone knows anything about saving a list of scriptable objects, and later reading the list from file, I would really appreciate your help :)

Thanks for taking the time to read my questions either way !

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Captain_Pineapple · Jan 31, 2019 at 01:03 PM

Hey there,

I'm not sure if i understand what your "scriptable object" is supposed to be but either way saving to JSON format mostly works out fine.

You can find a basic reference on how to do that HERE.

It basically transforms a Serializable object into a string based dictionary which can by saved to a file. Hope this helps!

Comment
Add comment · Show 13 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hellium · Jan 31, 2019 at 01:18 PM 1
Share

Here is the ScriptReference of ScriptableObjects

https://docs.unity3d.com/ScriptReference/ScriptableObject.html

The JsonUtility class is not able to serialize correctly nested ScriptableObjects.

avatar image Captain_Pineapple Hellium · Jan 31, 2019 at 01:43 PM 0
Share

Ah i see, I did not know that this existed. What is the use-case? why not create a pure class that is derived from nothing at all as a datacontainer?

avatar image haruna9x Captain_Pineapple · Jan 31, 2019 at 01:53 PM 1
Share

Because scriptableobject can be stored as an asset file. Is automatically serialized and deserialized by Unity, moreover, serialization that supports the same inheritance as classes derived from $$anonymous$$onoehaviour.

Show more comments
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

104 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to Save and Load a list of Scriptable Objects from a File? 2 Answers

how to have save and load system. With this programing,How to do a save and load system on mobile. With this programing 1 Answer

Loading Assetbundle scriptableobject settings. I can load the Scriptableobjects and place them in a list just fine but variables that are apart of it don't load. 1 Answer

My app generates a binary file but either fails to save data or load it || Unity for Android 1 Answer

How to save some integers and bools when a scene is switched. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges