Search Unity

Inspector Nested Scriptable Objects

Discussion in 'Open Projects' started by Sangemdoko, Nov 1, 2020.

  1. Sangemdoko

    Sangemdoko

    Joined:
    Dec 15, 2013
    Posts:
    222
    Hi,

    Since we are going to use a lot of scriptable objects (events, state machine, etc..) I was thinking we should probably add a custom inspector / property drawer to view & edit scriptable objects within an inspector they are referenced in. Something like this:

    upload_2020-11-1_12-22-47.png

    I was writing my own implementation but then thought people must have implemented that before.

    So here are some solutions I found:

    https://forum.unity.com/threads/editor-tool-better-scriptableobject-inspector-editing.484393/

    https://gist.github.com/tomkail/ba4136e6aa990f4dc94e0d39ec6a058c

    What do you think should we use one of those solutions, make our own, or do something else completely different?

    EDIT: One of the main hurdle is overflow exceptions when there is a loop of objects referencing each other. We could fix that by limiting the number of nested inspectors to 1, 2 or 3 (I doubt more would be useful)
     
    Last edited: Nov 1, 2020
  2. Neonage

    Neonage

    Joined:
    May 22, 2020
    Posts:
    287
    Peek solved this problem very elegantly with this little popup:
    upload_2020-11-6_15-45-29.png

    We can make similar thing to be by default and also have [Inline] attribute for some special cases :)