UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

60 lines (29 loc) 1.16 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [Player](./server.player.md) &gt; [setPersistedData](./server.player.setpersisteddata.md) ## Player.setPersistedData() method Set the persisted data for the player. This data can later be retrieved using [Player.getPersistedData()](./server.player.getpersisteddata.md)<!-- -->, even if a player disconnects and rejoin a game in the future, or joins a different HYTOPIA managed lobby of your game. **Signature:** ```typescript setPersistedData(data: Record<string, unknown>): Promise<Record<string, unknown> | void>; ``` ## Parameters <table><thead><tr><th> Parameter </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> data </td><td> Record&lt;string, unknown&gt; </td><td> The data to set. </td></tr> </tbody></table> **Returns:** Promise&lt;Record&lt;string, unknown&gt; \| void&gt; The persisted data for the player. ## Remarks This method is asynchronous and returns a promise that resolves to the player data.