UIHoverButton
Button that adds hover and click feedback states for richer interaction.
Create in the Editor
- Ensure there is a
UIControllerin the scene. - Create a GameObject and add
UIRect. - Add the
UIHoverButtoncomponent.
How to Use
- Get the component with
myObject.findComponent(UIHoverButton.class). - Read and write the component properties to control behavior.
- Test input or layout in Play mode.
Java Example
SpatialObject myObject = /* your object */;
UIHoverButton comp = myObject.findComponent(UIHoverButton.class);
if (comp != null) {
Texture tex = /* load texture */ null;
// set the border value:
comp.border = 1f;
// read the border value:
float borderValue = comp.border;
// read the clicked value:
boolean clickedValue = comp.clicked;
// set the clickedColor value:
comp.clickedColor = new Color(255, 255, 255, 255);
// read the clickedColor value:
Color clickedColorValue = comp.clickedColor;
// set the clickedTexture value:
comp.clickedTexture = tex;
// read the clickedTexture value:
Texture clickedTextureValue = comp.clickedTexture;
// read the fontFile value:
String fontFileValue = comp.fontFile;
// read the hover value:
boolean hoverValue = comp.hover;
// set the hoverTexture value:
comp.hoverTexture = tex;
// read the hoverTexture value:
Texture hoverTextureValue = comp.hoverTexture;
// read the justBeginHover value:
boolean justBeginHoverValue = comp.justBeginHover;
// set the normalColor value:
comp.normalColor = new Color(255, 255, 255, 255);
// read the normalColor value:
Color normalColorValue = comp.normalColor;
// set the normalTexture value:
comp.normalTexture = tex;
// read the normalTexture value:
Texture normalTextureValue = comp.normalTexture;
// set the padding value:
comp.padding = new Vector2(1, 1);
// read the padding value:
Vector2 paddingValue = comp.padding;
// set the resolution value:
comp.resolution = 1;
// read the resolution value:
int resolutionValue = comp.resolution;
// set the text value:
comp.text = "value";
// read the text value:
String textValue = comp.text;
// set the textClickedColor value:
comp.textClickedColor = new Color(255, 255, 255, 255);
// read the textClickedColor value:
Color textClickedColorValue = comp.textClickedColor;
// set the textHoverColor value:
comp.textHoverColor = new Color(255, 255, 255, 255);
// read the textHoverColor value:
Color textHoverColorValue = comp.textHoverColor;
// set the textNormalColor value:
comp.textNormalColor = new Color(255, 255, 255, 255);
// read the textNormalColor value:
Color textNormalColorValue = comp.textNormalColor;
// set the textSize value:
comp.textSize = 1f;
// read the textSize value:
float textSizeValue = comp.textSize;
}
Notes
- You can replace images or textures in the inspector or via code when the component supports it.