Get sibling custom editor

Hey… I’ve got a strange question…

I have few components on a GameObject and those have custom editors - is it possible to reach them from other custom editors? I mean - I’m asking how can I get custom component editor (inspector) reference to some other custom editor of a sibling component?

You can create an editor for a given type.

I don’t think you can easily “get” a specific, already existing editor. Imagine you have two Inspector windows open, that would mean you also have two instances of the custom editor running. So which one do you want? :wink:

If you need to exchange data between two editors, it needs to happen between the components. Eg one editor updates an Inspector value in a component due to some user input. Another editor just gets the other component’s value and need not know about who or why the value might have changed.

Oh… that’s a bummer… I am basically trying to make a button that exists in component editor A that will show/hide components (set hideFlags to HideInInspector), but it isn’t refreshing after that easily so I wanted to call Repaint() on each toggled component editor, but I can’t reach them…

You can always just have some static delegate the editor’s subscribe themselves to, and you invoke as needed.

2 Likes

Yea… it feels like it must be done like that… thanks =)

Well… it won’t be that easy tbh =/
I can’t unsubscribe components (OnDestroy is called even when it’s going to just be hidden) and even repaint won’t repaint whole component (I guess it’s for it’s content gui), so basically it just acts random and it’s not possible to keep handle for hidden component (after setting hideFlags reference becomes null)…