Referencing instances in Prefab and Scene with SerialzieField - Katsuya100/SceneLayer-Trial GitHub Wiki
If you want to have references across Prefab/Scene/ScriptableObject instances, use the CrossReference
class.
This technique is also useful when you want to have a reference to a Prefab instance that you plan to load into a Layer.
[SerializeField]
CrossReference<GameObject> _go;
It will then appear like this on the inspector.
Inserting an object into this field automatically creates a CrossReferenceRegister
component and registers the instance.
When executed, the object reference can be obtained after instantiation of the target object.
If a scene's GameObject is referenced and the corresponding scene is not open,
the scene reference and GlobalObjectID will be displayed in the Inspector.
When registering a ScriptableObject with CrossReference, the member must be set as follows.
[SerializeField]
CrossReferenceRegisterObject _crossReferenceRegister;
Then, open the Inspector of the target ScriptableObject and click on the [Register] button.
This will ensure that references are automatically allocated when the ScriptableObject is loaded.