HiHello - I’ve been hitting some issues with structure some dropdown elements to update properly within a custom inspector. I’m fairly new to the UI Toolkit, so I imagine that my lack of experience being the main blocker to my sadness.
I’m currently building a ui with three separate dropdown elements that hold some basic information for setting up a login event. I think I’m hitting two issues that I would appreciate some help / guidance with, the first being how to properly refresh a dropdowns data and the second being how to properly bind to dropdown elements.
Some context - The basic need for these elements is to update their choices dynamically in order to reflect the correct login data. The first dropdown acts as the first link in the chain of elements and when that value is modified it will trigger the bottom two dropdowns to refresh their choices. I setup this chain of commands for these dropdown elements during CreateInspectorGUI when I search and setup each element with the proper callback and bindingpath. That part works out all fine, however I cannot get the values in the dropdown to update their display without manually triggering the Inspector UI to redraw itself (I usually just click to a different gameobj to trigger this redraw
). I had previously built out this ui with PropertyDrawers and PropertyAttribrutes, and I went through the update process manually whenever OnValidate was called. But since UI Toolkit binding stuff looks pretty spiffy, I thought that migrating from IMGUI would clean up and simplify my messy code.
So, for Question 1 - What is the recommended approach to updating a dropdown element dynamically? Is it expected that I re-assign the values for choices during the callback events? Or is there where bindings are suppose to come in? Which sorta leads into…
Question 2 - How does one go about binding a dropdown element?
… I have been using bindings with other controllers without issue, but I haven’t been able to understand how dropdown binding works. I typically set these elements up with a bindingpath to a List, and let the CreateInspectorGUI bind the element…but those bindings don’t seem to stick.