Hello, I was trying out to create a simple UI, which contain a simple form. In this form I wanted to have some text input field and toggles. The problem I have right now is that I can’t find any simple way to group my toggles. I would like to have only one enabled (or set to true) toggle in the group. Is such a feature built in the UI Toolkit?
Hey, what’s the status on UI Toolkit toggle groups? Or the same functionality as GUI.Toolbar from the previous system? Something like this:
Should we just implement them as buttons in a horizontal layout and manage the checked state with styling or is there a built-in control that ensures the editor styling is consistent?
So for 2021.1, there still isn’t a replacement for the GUI.Toolbar as UI Toolkit control?
I’ve already asked this a long time ago, which if I remember correctly, was also replied with “not at the moment, use ToolbarToggle”.
So now theres a GroupBox which is a foundation for RadioButtonGroup, but it doesn’t manage the ToolbarToggle because it doesn’t implement IGroupBoxOption right?
Are we supposed to inherit from ToolbarToggle and add IGroupBoxOption?
Edit: just noticed IGroupBoxOption is internal, so you cannot even use it
I completely misunderstood what the GUI.Toolbar does, sorry about that!
But we indeed don’t have that same control on the UI Toolkit side, so you’d have to implement your own.
You have an example on the UI Builder, it’s called ButtonStrip. If you use the UI Builder from a package (with Unity 2020.3 or 2021.1 for example), you have easy access to the source code.
Sometimes some controls get implemented in a fashion that we are not comfortable making available to the public because we didn’t have the time to really validate the API and usability are the correct one, but we still need to have the component internally. That doesn’t mean it’ll never be out to public, just means the current implementation is not ready to be public yet! I can assure you that such a common use case is on our radar and there will be some default implementation at some point
Hello, thanks for the reply! I do hope there is also an alternate to RadioButtonGroup, which is BaseField, so we can have IMGUI GUILayout.Toolbar equivalent like this use case.