API reference
API reference
Select your platform
No SDKs available
No versions available

ButtonClickEventArgs

ButtonClickEventArgs

class ButtonClickEventArgs(val hitInfo: HitInfo, val dataModel: DataModel) : EventArgs
Event arguments for button click events.
ButtonClickEventArgs is used to pass information about a button click interaction through the event system. It contains a HitInfo object that provides details about the interaction, such as the hit point, normal, and distance.
This class is typically used when registering event listeners for button click events on entities, allowing components to respond to user interactions.
Example usage:
// Register a button click event listener on an entity
entity.registerEventListener<ButtonClickEventArgs>(ButtonClickEventArgs.EVENT_NAME) { entity, eventArgs ->
    // Handle the button click event
    val hitPoint = eventArgs.hitInfo.hitPoint
    // Perform actions based on the click
}

// Send a button click event to an entity
dataModel.sendEvent(
    entity,
    ButtonClickEventArgs.EVENT_NAME,
    ButtonClickEventArgs.fromHitInfo(hitInfo, dataModel)
)

Constructors

NameSummary
ButtonClickEventArgs
constructor(hitInfo: HitInfo, dataModel: DataModel)

Types

NameSummary
Companion
object Companion

Properties

NameSummary
dataModel
val dataModel: DataModel
eventName
val eventName: String
handled
var handled: Boolean
hitInfo
val hitInfo: HitInfo

Information about the hit/interaction that triggered the button click
throttleTime
var throttleTime: Int?

Companion

object Companion

Properties

NameSummary
EVENT_NAME
const val EVENT_NAME: String

The name of the button click event, used when registering event listeners.

Functions

NameSummary
fromHitInfo
fun fromHitInfo(hitInfo: HitInfo, dataModel: DataModel): ButtonClickEventArgs

Creates a ButtonClickEventArgs instance from a HitInfo object and DataModel.
Did you find this page helpful?