Skip to main content

UIRadioButton

Selectable option that works with a radio group to keep only one active.

Create in the Editor

  1. Ensure there is a UIController in the scene.
  2. Create a GameObject and add UIRect.
  3. Add the UIRadioButton component.

How to Use

  1. Get the component with myObject.findComponent(UIRadioButton.class).
  2. Read and write the component properties to control behavior.
  3. Test input or layout in Play mode.

Java Example

SpatialObject myObject = /* your object */;
UIRadioButton comp = myObject.findComponent(UIRadioButton.class);
if (comp != null) {
Texture tex = /* load texture */ null;
// set the checked value:
comp.checked = true;
// read the checked value:
boolean checkedValue = comp.checked;
// read the pressed value:
boolean pressedValue = comp.pressed;
// read the down value:
boolean downValue = comp.down;
// read the up value:
boolean upValue = comp.up;

// set the color value:
comp.color = new Color(255, 255, 255, 255);
// read the color value:
Color colorValue = comp.color;

// set the checkedTexture value:
comp.checkedTexture = tex;
// read the checkedTexture value:
Texture checkedTextureValue = comp.checkedTexture;

// set the uncheckedTexture value:
comp.uncheckedTexture = tex;
// read the uncheckedTexture value:
Texture uncheckedTextureValue = comp.uncheckedTexture;

}

Notes

  • You can replace images or textures in the inspector or via code when the component supports it.