Search Unity

ScriptableObject Editor field goes null prior to its OnDisable in parent MonoBehaviour Editor

Discussion in 'Immediate Mode GUI (IMGUI)' started by PropositionOne, Jul 25, 2015.

  1. PropositionOne

    PropositionOne

    Joined:
    Jul 25, 2015
    Posts:
    13
    I'm working on a special custom inspector class that has a MonoBehaviour Editor class that creates Monobehaviour Editor children editors which create ScriptableObject editors.




    My problem is that "OnDisable" isn't being called on the "ScriptableObject" Editor when I deselect the main object. OnDisable works on the 2nd MonoBehaviour Object, but not on the latter object. Even stranger is the fact that when I check the field in the "2nd Script" on its "OnDisable" method, the field which holds the "3rd Script" object has reverted to null. It's not null until just prior to the OnDisable method being called on the 2nd Script.

    If it weren't for the fact that my field is suddenly going null, it wouldn't be a problem as I could just call a custom disable method.

    Anyway... I hope my problem is clear enough, if anyone has any suggestions as to what might be going on, I'm all ears.

     
    Last edited: Jul 25, 2015
  2. AhrenM

    AhrenM

    Joined:
    Aug 30, 2014
    Posts:
    74
    What class does your ScriptableObject Editor derive from?