So this is a bit outside my area of expertise but I did reach out to an expert and we chatted about this issue. Let me relay the information that was given and you can let me know if it works.
- Looks like SetGroup is on // UiRadioButtonCommunicationInterface
- where as GetGroup is on // UiRadioButtonInterface
- But UiRadioButtonComponent does inherit from both of those busses
- It feels more like you’re not intended to call SetGroup
- Instead you’re expected to do something like this
- So it sounds more like the answer is, a radio button group is an actual component, on an entity, with an entityid.
- So after spawning your radio button you’d call
- This internally calls SetGroup and adds it to the list
- We have an actual example of what this person is doing in fact.
function RadioButtonSpawner:OnTopLevelEntitiesSpawned(ticket, ids)
-- we could do this in OnSpawnEnd but this is a convenient way to add each top-level element
-- spawned to be part of the radio button group. There is only one top-level element in the
-- dynamic slice and we know it is the radio button
for i = 1,#ids do
local parent = UiElementBus.Event.GetParent(ids[i])
if parent == self.Properties.SpawnerElement then
- Note that AddRadioButton automatically calls SetGroup but also adds the button to the list of buttons that the group manages
- But it looks like in lyshine there is an entity (with an id) that has a RadioButtonGroup component on it.
- That component’s job is to keep a list of all the radio buttons in the group so that when you click on one it can loop over the rest and turn them off
- Once you spawn a radio button (which is the individual clickable thing) you need to add it to the group that handles it, so that it can start tracking it
- They should not list SetGroup, that is private
*They should instead say in GetGroup that you can use the Radio button group Bus event “AddRadioButton” to change groups, see (blah blah example).
Hope this helps,