Version: 2022.1
LanguageEnglish
  • C#

ScriptableObject.OnValidate()

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual

Description

Editor-only function that Unity calls when the script is loaded or a value changes in the Inspector.

You would usually use this to perform an action after a value changes in the Inspector; for example, making sure that data stays within a certain range. It is not supported for a script to modify values on other scripts than itself.

Note: You cannot reliably perform Camera rendering operations here. Instead, you should add a listener to EditorApplication.update, and perform the rendering during the next Editor Update call.