Search Unity

Replace [ExecuteInEditMode] to a fully Editor Way

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

  1. usernameHed

    usernameHed

    Joined:
    Apr 5, 2016
    Posts:
    93
    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.

    Thanks!