Unity UI Toolkit - Unable to select child element

312 Views Asked by At

I am trying to select the highlighted element using the selector shown in the search box:

#StateEvent > * > .unity-foldout__input

But it doesn't seem to be able to find it - no search results found. And in code it is unable to be found too with the following query: var stateEventLabel = debugMainRoot.Q("#StateEvent > * > .unity-foldout__input"); enter image description here

What selector should I use to be able to select this element? Thanks

1

There are 1 best solutions below

0
Andrew Łukasik On

Try var stateEventLabel = debugMainRoot.Q("StateEvent .unity-foldout__input");

Here is a cheat sheet from UI Builder window:

how to create a selector