MyBox
MyBox copied to clipboard
SceneReference bugs out OnValidate when selecting a prefab asset in the project view.
trafficstars
Reproduce;
- Create a gameobject, add a MonoBehaviour script with;
[SerializeField] private SceneReference sceneReference; - Make the GO into a prefab.
- Select the prefab asset in the project view.
- Add a scene to the reference.
- deselect and reselect the prefab asset.
- Unity gets stuck in what looks like an OnValidate loop.
- .....
- Loss?
If it indeed is due to OnValidate being run somewhere, we need something like;
UnityEditor.EditorUtility.IsPersistent(gameObject)
or
gameObject.scene.IsValid()