Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Replace [ExecuteInEditMode] to a fully Editor Way

Discussion in 'Editor & General Support' started by usernameHed, Nov 12, 2020.

  1. usernameHed


    Apr 5, 2016
    Hello I have an editor question: I have a script MyScript, with the attribute [ExecuteInEditMode], I use it to use the Awake(), and Update() of the Monobehaviour also in editor.

    But I would like the clean version of it, I don't like to have editor code inside monobehaviour. So I created an MyScriptEditor. Now my question is: How to trigger a custom Awake / update fonction inside the editor script ? (WITHOUT the gameObject behing selected!).

    The OnEnable / OnDisable function of an editor script are triggered when the gameObject containing the script is selected once.