<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [client](./client.md) &gt; [HytopiaUI](./client.hytopiaui.md)

## HytopiaUI class

Global API for interacting with the HYTOPIA game client. Access via the `hytopia` global variable in your client-side HTML UI code.

**Signature:**

```typescript
export declare class HytopiaUI 
```

## Properties

<table><thead><tr><th>

Property


</th><th>

Modifiers


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[cameraFar](./client.hytopiaui.camerafar.md)


</td><td>

`readonly`


</td><td>

number


</td><td>

Maximum render distance of the camera in world units. Objects beyond this distance are not rendered.


</td></tr>
<tr><td>

[cameraNear](./client.hytopiaui.cameranear.md)


</td><td>

`readonly`


</td><td>

number


</td><td>

Minimum render distance of the camera in world units. Objects closer than this distance are not rendered.


</td></tr>
<tr><td>

[gltfLoader](./client.hytopiaui.gltfloader.md)


</td><td>

`readonly`


</td><td>

typeof GLTFLoader


</td><td>

Access to a THREE.js GLTFLoader instance for loading 3D models, useful if you want to render models in your UI.


</td></tr>
<tr><td>

[isMobile](./client.hytopiaui.ismobile.md)


</td><td>

`readonly`


</td><td>

boolean


</td><td>

Detects if the player is on a mobile device. Use this to adjust UI layout or controls, etc.


</td></tr>
<tr><td>

[three](./client.hytopiaui.three.md)


</td><td>

`readonly`


</td><td>

typeof THREE


</td><td>

Access to the THREE.js library for advanced 3D rendering. Use for custom visual effects in your UI.


</td></tr>
</tbody></table>

## Methods

<table><thead><tr><th>

Method


</th><th>

Modifiers


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

[connectArrow(source, target, options)](./client.hytopiaui.connectarrow.md)


</td><td>


</td><td>

Creates an arrow between two points or entities.


</td></tr>
<tr><td>

[disconnectArrow(arrowId)](./client.hytopiaui.disconnectarrow.md)


</td><td>


</td><td>

Removes an arrow by its ID.


</td></tr>
<tr><td>

[filterProfanity(text)](./client.hytopiaui.filterprofanity.md)


</td><td>


</td><td>

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).


</td></tr>
<tr><td>

[freezePointerLock(freeze)](./client.hytopiaui.freezepointerlock.md)


</td><td>


</td><td>

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.


</td></tr>
<tr><td>

[getEntityIdByName(name)](./client.hytopiaui.getentityidbyname.md)


</td><td>


</td><td>

Finds an entity by its name property and returns its ID. If multiple entities have the same name, returns the first one found.


</td></tr>
<tr><td>

[getPlayerEntityId()](./client.hytopiaui.getplayerentityid.md)


</td><td>


</td><td>

Gets the entity ID of the current player's entity. Returns undefined if the player entity is not yet initialized.


</td></tr>
<tr><td>

[getSceneUITemplateRenderer(templateId)](./client.hytopiaui.getsceneuitemplaterenderer.md)


</td><td>


</td><td>

Retrieves a registered Scene UI template renderer function.


</td></tr>
<tr><td>

[hasProfanity(text)](./client.hytopiaui.hasprofanity.md)


</td><td>


</td><td>

Checks if text contains inappropriate language. Useful for validating input before sending to the server.


</td></tr>
<tr><td>

[hasSceneUITemplateRenderer(templateId)](./client.hytopiaui.hassceneuitemplaterenderer.md)


</td><td>


</td><td>

Checks whether a Scene UI template is currently registered.


</td></tr>
<tr><td>

[lockPointer(lock, maintainInput)](./client.hytopiaui.lockpointer.md)


</td><td>


</td><td>

Controls pointer lock for your UI. When locked, the cursor is hidden and mouse movement controls the camera. Call with `true` when hiding your UI so players can control the camera, `false` when showing UI that needs cursor interaction. Pointer lock only affects Desktop devices.


</td></tr>
<tr><td>

[offAllData()](./client.hytopiaui.offalldata.md)


</td><td>


</td><td>

Removes all registered data event listeners.


</td></tr>
<tr><td>

[offData(callback)](./client.hytopiaui.offdata.md)


</td><td>


</td><td>

Removes a specific data event listener. Pass the same callback function used in `onData()`<!-- -->.


</td></tr>
<tr><td>

[onData(callback)](./client.hytopiaui.ondata.md)


</td><td>


</td><td>

Registers a listener for data received by the server from `player.ui.sendData()`<!-- -->.


</td></tr>
<tr><td>

[pressInput(input, pressed)](./client.hytopiaui.pressinput.md)


</td><td>


</td><td>

Simulates player input programmatically. Useful for creating custom UI controls that trigger game actions, such as for mobile UI buttons.


</td></tr>
<tr><td>

[registerSceneUITemplate(templateId, templateRenderer)](./client.hytopiaui.registersceneuitemplate.md)


</td><td>


</td><td>

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.


</td></tr>
<tr><td>

[sendData(data)](./client.hytopiaui.senddata.md)


</td><td>


</td><td>

Sends data from your UI to the game server. The server receives this via `player.ui.on(PlayerUIEvent.DATA, callback)`<!-- -->. Use this to notify the server of player actions taken in your custom UI.


</td></tr>
<tr><td>

[setEntityColorCorrection(entityId, color)](./client.hytopiaui.setentitycolorcorrection.md)


</td><td>


</td><td>

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.


</td></tr>
<tr><td>

[setMouseSensitivityMultiplier(multiplier)](./client.hytopiaui.setmousesensitivitymultiplier.md)


</td><td>


</td><td>

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.


</td></tr>
<tr><td>

[unregisterLoadedSceneUITemplates()](./client.hytopiaui.unregisterloadedsceneuitemplates.md)


</td><td>


</td><td>

Removes all custom Scene UI templates. Built-in HYTOPIA templates (prefixed with `hytopia:`<!-- -->) are preserved. Use this when cleaning up your game code on disconnect or world change.


</td></tr>
<tr><td>

[unregisterSceneUITemplate(templateId)](./client.hytopiaui.unregistersceneuitemplate.md)


</td><td>


</td><td>

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.


</td></tr>
</tbody></table>

