Method OnValidate OnValidate() Editor-only function that Unity calls when the script is loaded or a value changes in the Inspector. Declaration protected virtual void OnValidate()