Search Unity

Resolved ScriptableObject OnEnable won't be called on Editor startup

Discussion in 'Editor & General Support' started by Saeed-Barari, Jan 22, 2023.

  1. Saeed-Barari

    Saeed-Barari

    Joined:
    Jul 12, 2021
    Posts:
    56
    Hi. I've created an SO that logs something on
    OnEnable
    , but the problem is that it seems it won't get called on editor startup, that is, when I open up Unity Editor. It does work on domain reload (when editing scripts or entering playmode with
    EnterPlayModeOptions.None
    is set)
    Is this the supposed way? or is there something wrong. I'm using Unity 2021.2.13f1

    take this script as an example:
    Code (CSharp):
    1.  
    2. class SO : ScriptableObject {
    3.     void OnEnable() => Debug.Log( "Enabled" );
    4. }
    5.  
    thanks
     
  2. Saeed-Barari

    Saeed-Barari

    Joined:
    Jul 12, 2021
    Posts:
    56