Global API for interacting with the HYTOPIA game client. Access via the hytopia global variable in your client-side HTML UI code.
Signature:
export declare class HytopiaUI |
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
|
number |
Maximum render distance of the camera in world units. Objects beyond this distance are not rendered. | |
|
|
number |
Minimum render distance of the camera in world units. Objects closer than this distance are not rendered. | |
|
|
typeof GLTFLoader |
Access to a THREE.js GLTFLoader instance for loading 3D models, useful if you want to render models in your UI. | |
|
|
boolean |
Detects if the player is on a mobile device. Use this to adjust UI layout or controls, etc. | |
|
|
typeof THREE |
Access to the THREE.js library for advanced 3D rendering. Use for custom visual effects in your UI. |
|
Method |
Modifiers |
Description |
|---|---|---|
|
Creates an arrow between two points or entities. | ||
|
Removes an arrow by its ID. | ||
|
Filters inappropriate language from text by replacing profanity with asterisks. Use this to sanitize user-generated content displayed in your UI (e.g., chat messages, usernames). | ||
|
Freezes or unfreezes the pointer lock state. Preventing player inputs from automatically locking or unlocking the pointer. Esc key will still unlock the pointer - this is a system level feature that cannot be overriden. Pointer lock only affects Desktop devices. | ||
|
Finds an entity by its name property and returns its ID. If multiple entities have the same name, returns the first one found. | ||
|
Gets the entity ID of the current player's entity. Returns undefined if the player entity is not yet initialized. | ||
|
Retrieves a registered Scene UI template renderer function. | ||
|
Checks if text contains inappropriate language. Useful for validating input before sending to the server. | ||
|
Checks whether a Scene UI template is currently registered. | ||
|
Controls pointer lock for your UI. When locked, the cursor is hidden and mouse movement controls the camera. Call with | ||
|
Removes all registered data event listeners. | ||
|
Removes a specific data event listener. Pass the same callback function used in | ||
|
Registers a listener for data received by the server from | ||
|
Simulates player input programmatically. Useful for creating custom UI controls that trigger game actions, such as for mobile UI buttons. | ||
|
Registers a custom Scene UI template that will instantiate when a SceneUI on the server for the given templateId is loaded. Templates define how your UI should render for each Scene UI instance created by the server. | ||
|
Sends data from your UI to the game server. The server receives this via | ||
|
Applies color tint to an entity on the client only (does not affect other players' view). Use for client-side visual effects like highlighting, damage indicators, or team colors. | ||
|
Adjusts the user's base mouse sensitivity for camera rotation. Values above 1.0 increase sensitivity, below 1.0 decrease it. Useful for providing sensitivity settings in your UI options menu. | ||
|
Removes all custom Scene UI templates. Built-in HYTOPIA templates (prefixed with | ||
|
Removes a registered Scene UI template. The template will no longer be available for new Scene UI instances. Existing instances using this template are not affected. |