Hello.
I have a ScriptableObject, it has an field Object _scene;
This field contains a reference to SceneAsset.
Q: When unity load ScriptableObject, it will load the ENTIRE scene into memory using the link _scene?
I’m afraid that having 10 ScriptableObject each of them will load scene in memory with all objects.
P.S. I want to load the stage myself if necessary.
You can’t reference scene files like that. Scenes need to be added to the build or they’re stripped from builds. They exist outside Unitys asset referencing system that determines what’s included in a build.
1 Like
The SceneAsset class is an editor only class. So you can not actually use it in a build game. However it can be used to work with them in the editor in order to get a neat editor what allows you to reference scenes. Just like the example on the SceneAsset documentation page.
The managed SceneAsset class itself is just an empty class that is derived from UnityEngine.Object. It contains no data or functionality. So it’s just a typed asset reference that only works inside the editor. Like Cameron just said, you have to add scenes to the scenes list in the build window in order tor it to be included in a build. You could use the SceneManager and its Scene class to work with scenes at runtime. Though those can not be referenced directly. You usually should store the scene name or the index of the scene. Storing the name is usually preferred since the index can change when you add / remove / deactivate scenes in the build list.
1 Like