Button

Function Description
activate()

Triggers the action assigned to the button as if it was tapped.

isVisible()

Returns true if the Button is visible, false if not. If a Button is not visible it cannot be tapped.

onClick

Function assigned to this property will be executed when user touches the button.

opacity()

Returns the opacity of the button.

position()

Returns position of the button.

rotation()

Returns the rotation of the button.

scale()

Returns the scale of the button.

setOpacity(value)

Sets the opacity of a button. Note: Setting the opacity to 0 will make the button invisible, but still tappable. If you’d like to hide a button entirely, use setVisible(false).

setPosition(x, y, z)

Sets the position of the button.

setRotation

Sets the rotation of the button.

setScale()

Sets the scale of the button.

setVisible(value)

Sets the visibility of a button. If a button is not visible, it cannot be tapped. If you’d like an invisible but tappable button, use setOpacity(0).


activate()

Triggers the action assigned to the button as if it was tapped.

↑ Back to top


isVisible()

Returns true if the Button is visible, false if not. If a Button is not visible it cannot be tapped.

Returns

boolean true if the Button is visible, false if not

↑ Back to top


onClick

Function assigned to this property will be executed when user touches the button.

  let button = this.ui().find('MyButton')[0];
  button.onClick = function(){
    Ads.showInterstitial();
  }

↑ Back to top


opacity()

Returns the opacity of the button.

Returns

number the opacity of the button. Range: 0-255.

↑ Back to top


position()

Returns position of the button.

Returns

Vec3 {x, y, z} position of the button.

↑ Back to top


rotation()

Returns the rotation of the button.

Returns

Vec3 {x, y, z} rotation of the button.

↑ Back to top


scale()

Returns the scale of the button.

Returns

Vec {x, y, z} scale of the button.

↑ Back to top


setOpacity(value)

Sets the opacity of a button. Note: Setting the opacity to 0 will make the button invisible, but still tappable. If you’d like to hide a button entirely, use setVisible(false).

Parameters

number value – Range: 0-255. The lower the value, the less opaque the button becomes.

↑ Back to top


setPosition(x, y, z)

Sets the position of the button.

Parameters

number x – the x comopnent of the new position
number y – the y comopnent of the new position
number z – the z comopnent of the new position

↑ Back to top


setRotation

Sets the rotation of the button.

Parameters

number x – the x comopnent of the new rotation
number y – the y comopnent of the new rotation
number z – the z comopnent of the new rotation

↑ Back to top


setScale()

Sets the scale of the button.

Parameters

number x – the x comopnent of the new scale
number y – the y comopnent of the new scale
number z – the z comopnent of the new scale

↑ Back to top


setVisible(value)

Sets the visibility of a button. If a button is not visible, it cannot be tapped. If you’d like an invisible but tappable button, use setOpacity(0).

Parameters

boolean value – true for visible, false for not visible.

↑ Back to top

Did you find this page useful?

Please give it a rating:

Please provide some feedback!

This is very helpful to us.