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.
If you're interested in the ZepetoPlayer API, refer to the documentation:
Make use of the OnAddedLocalPlayer() callback to verify if the Local Player has loaded.
Here's a sample code illustrating this:
- 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.
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.
Updated 10 Oct 2024
Did this page help you?