Save ScriptableObject to Scene

Hey I’d like to keep my ScriptableObject only in Scene, not in the Asset Database.

A quote from the Serialization blog entry:
“Asset types (Materials / Meshes / AnimationClip / SerializedObject’s) that are created from code are saved in the scene so long as a game object or their components in the scene references it.”

So, my ScriptableObject IS actually being referenced by one of my MonoBehaviours, but it’s still not being serialized. Has this been changed since Unity 5 ?

#bump

pretty sure thats not what the blog meant. I think it implied that ScriptableObjects (SO) that are instantiated at runtime will be removed by the garbage collector (GC) UNLESS a component is still referencing it. and once those components are unloaded (via being destroyed, level loaded, pressing un-play, etc.) then that SO is then collected by the GC and deleted.

you’ll have to manually serialize that SO into a file via with a fileformatter (commonly a binaryformatter), or using the JSON class that was added in the recent versions of Unity, or actually make it an asset that will be referenced in scene.

or get something from the asset store to help do it for you