After a lot of searching I'm unable to find a way to validate a value only at scene (i.e. not at prefab stage). What I mean is something like: Code (CSharp): public class NonPrefabValidator : MonoBehaviour { [SerializeField] GameObject mandatorySceneTarget = default; private void OnValidate() { if (isNotPrefab && mandatorySceneTarget == null) { Debug.LogWarning("Target at scene/gameObject/component/coords is not inspector assigned.", this); } } } I have tried: Code (CSharp): #if UNITY_EDITOR //if (PrefabStageUtility.GetCurrentPrefabStage() == null) { if (PrefabStageUtility.GetPrefabStage(this.gameObject) == null) { #endif Debug.LogWarning("Target at scene/gameObject/component/coords is not inspector assigned.", this); #if UNITY_EDITOR } #endif But that still gets warnings on play. I assume that is when the initial prototype is created because it is not detected as a prefab but mandatorySceneTarget is still null.
This should be correct: Code (CSharp): PrefabStageUtility.GetPrefabStage(this.gameObject) == null I'm not sure what you mean when you say that you still gets warnings on play. What warnings? Your own warning here? Could you post the entirety of the method?