MyBox icon indicating copy to clipboard operation
MyBox copied to clipboard

SceneReference bugs out OnValidate when selecting a prefab asset in the project view.

Open TheXRMonk opened this issue 4 years ago • 0 comments
trafficstars

Reproduce;

  1. Create a gameobject, add a MonoBehaviour script with; [SerializeField] private SceneReference sceneReference;
  2. Make the GO into a prefab.
  3. Select the prefab asset in the project view.
  4. Add a scene to the reference.
  5. deselect and reselect the prefab asset.
  6. Unity gets stuck in what looks like an OnValidate loop.
  7. .....
  8. Loss?

If it indeed is due to OnValidate being run somewhere, we need something like; UnityEditor.EditorUtility.IsPersistent(gameObject) or gameObject.scene.IsValid()

TheXRMonk avatar Nov 24 '20 12:11 TheXRMonk