CREATE YOUR WORLD
Players & Characters: Basic

ZEPETO Player

5min

The ZepetoPlayer serves as the unit instance for the ZEPETO character in a multiplayer world. It represents both the player you directly control and other players in the scene.

In this guide, we'll explore how to utilize the ZEPETO Player's API to display information about the Local Player you're operating.



Zepeto Player API

If you're interested in the ZepetoPlayer API, refer to the documentation:



Basic Local Player Usage Example

Checking the Loading Status of the Local Player

Make use of the OnAddedLocalPlayer() callback to verify if the Local Player has loaded.

Here's a sample code illustrating this:

TypeScript




  • Script Explanation:
    • Initially, the this._localPlayer is undeclared, meaning it has a null value. You create the local player based on the logged-in user ID using
    • ZepetoPlayers.instance.CreatePlayerWithUserId(). Once the local player has finished loading, the OnAddedLocalPlayer() callback assigns value to this._localPlayer.
    • This method allows you to load the local player and verify its loading status.
Document image




Displaying Local Player Information

Below is an example of how to print the zepeto ID, user ID, and name of the loaded local player to the console log.

Please note that in the sample code provided, ZepetoPlayers.instance.CreatePlayerWithUserId() is not explicitly added.

TypeScript

Document image