Event||doc136849

September 20, 2022

Event

Global singleton object

Brief Introduction

The engine defines some global events in advance, such as client initialization event, player login event, player logout event, etc. Developers can also register custom events to pass messages across scripts. The event object is BindableEvent, which can be used to bind a callback function and emit the event.

Function

BindableEvent GetEventstring eventName, string space )
Get events in the specified space
void RegisterCustomEventstring eventName )
Register custom events

Engine global events

BindableEvent OnClientInitDone [ClientOnly]
When the client completes initialization
BindableEvent OnLoadMapDone [ClientOnly]
When the current scene of the client is loaded
BindableEvent OnTrayItemChanged [ClientOnly]
When the backpack props of client players change
BindableEvent OnPlayerLogin
When players log in
BindableEvent OnPlayerLogout
When players log out
BindableEvent OnPlayerReconnect [ClientOnly]
When players reconnect
BindableEvent OnEntityAdded [ClientOnly]
After the entity object is generated
BindableEvent OnEntityRemoved [ClientOnly]
Entity object before destruction
BindableEvent OnTouchScreenBegin [ClientOnly]
At the beginning of touching the screen
BindableEvent OnTouchScreenMove [ClientOnly]
When sliding the screen
BindableEvent OnTouchScreenEnd [ClientOnly]
At the end of touching the screen