Component:TouchButton
More actions

The TouchButton component is used to make a physical button with no press depth that is instantly pressable upon click or touch. It interacts with components such as Component:TipTouchSource on an avatar.
For a button with press depth, please see PhysicalButton.
Fields
| Name | Type | Description |
|---|---|---|
persistent
|
Bool | Determines whether or not this item will be saved to the server. |
UpdateOrder
|
Int | Controls the order in which this component is updated. |
Enabled
|
Bool | Controls whether or not this component is enabled. Some components stop their functionality when this field is disabled, but some don't. |
IsPressed
|
Bool | Whether the button is pressed or not |
IsHovering
|
Bool | Whether the button is being pointed at with the laser in the case of a touch button |
AcceptPhysicalTouch
|
Bool | Whether to allow Component:TipTouchSources to interact with/activate this component. |
AcceptRemoteTouch
|
Bool | Whether this component allows interaction via the user's interaction laser. |
AcceptOutOfSightTouch
|
Bool | Whether or not to allow interaction with this component if it is out of the user's view. |
EditModeOnly
|
Bool | Whether this button will only work if the user is in Edit Mode |
ActiveUserFilter
|
ActiveUserHandling | How to handle user interaction depending on active user. |
Pressed
|
delegate of identity ButtonEventHandler | The Sync Delegate to call when the button is pressed. |
Pressing
|
delegate of identity ButtonEventHandler | The Sync Delegate to call when the button is being pressed every game tick. |
Released
|
delegate of identity ButtonEventHandler | The Sync Delegate to call when the button is released. |
BeginPressVibration
|
VibratePreset | What vibration to send when this button is starting to be pressed. |
PressVibration
|
VibratePreset | What vibration to send when this button is pressed. |
HoverVibration
|
VibratePreset | What vibration to send when this button is hovered over via laser. |
Label
|
IField`1<String> | The field that represents this button's label. |
Usage
Used in boopers and buttons where PhysicalButton is a bad choice because the button press needs to have no press depth. In the case where the user does want press depth, use PhysicalButton.
The ActiveUserFilterfield can be used to prevent accidental triggering by the active user or ensure only the active user can be triggered, see: Type:ActiveUserHandling
Be aware that while this works with Component:MeshCollider that because a Touch tip is a raycast with a set distance, a mesh collider is very likely to "slip" past the raycast origin, making it unreliable in many situations. Setting the matching collider to 'dual sided' can help but can create many touch events as it 'bounces' between sides.
Examples
See Also
- IButton For a list of button types.