TargetBinding Reference doesn't show available components, it just selects the first one

Issue #93 resolved
Christian Oeing repo owner created an issue

Report by Ruben via mail:

Gerade habe ich einen Issue gefunden:

Ich habe ein GameObject mit einer Image und einer Button Komponente

Ich habe ein weiteres GameObject, an welches ich die Komponente BehaviourEnabledSetter attache

Target Binding stelle ich auf Reference

Wenn ich nun das GameObject mit Image und Button Komponenten auf das Reference-Feld ziehe, bekomme ich keine Auswahl, welche der beiden Komponenten ich denn enablen/disablen möchte

Stattdessen wir einfach die erste valide Komponente genutzt

Steht die Image-Komponente ganz oben, wird diese genutzt

Steht die Button-Komponente ganz oben, wird diese genutzt

Der Grund, newReference ist direkt schon der Button oder das Image ist somit kommt die Auswahl gar nicht erst, da es nicht zu einem GameObject gecastet werden kann.

Comments (4)

  1. Christian Oeing reporter

    The problem is that EditorGUI.ObjectField returns the first matching behaviour of the dragged game object for the allowed type and there is no indicator if a game object was dragged or if there are multiple matching behaviours on it.

  2. Christian Oeing reporter

    The new logic is to find out if the dropped object was a game object. If so, the component picker is always shown (if more than one component of the game object match the desired type).

  3. Log in to comment