Search Unity

Question Display ScriptableObject custom inspector when object field is assigned

Discussion in 'Immediate Mode GUI (IMGUI)' started by lo-94, Nov 30, 2022.

  1. lo-94

    lo-94

    Joined:
    Nov 1, 2013
    Posts:
    282
    Hey all,

    So subject is a little confusing but basically this is what I'm trying to achieve

    I created a custom editor for a scriptable object type using the CustomEditor approach, this works as expected
    Now what I would like is for this custom editor to be displayed in other MonoBehaviour scripts that have this ScriptableObject as a property
    So if the ScriptableObject field is unassigned/null, the custom editor is not displayed
    Once the field is assigned, I would like the custom editor to be displayed beneath the field in the inspector of that script so the user doesn't have to open up the scriptable object within the hierarchy to modify it for convenience purposes

    How would I go about doing this? I tried searching, but am mostly just getting results for how to display a custom editor for a scriptable object, not for showing the values of the scriptable object beneath the field in a separate script

    Thanks in advance!
     
    Last edited: Nov 30, 2022