CREATE YOUR WORLD
Players & Characters: Tips
Get the current location of the ZEPETO character
5min
this guide will show you how to check the current location of a local player's zepeto character within zepeto world the location information is stored in the transform object's position, so it is important to access the zepeto player's transform to find their location step 1 writing the script select the \[+] menu in the top left corner of the \[project] panel or choose assets > create > zepeto > typescript rename the added script to getposition and write a sample script as follows getposition import { zepetoscriptbehaviour } from 'zepeto script'; import { zepetoplayers, zepetocharacter } from 'zepeto character controller'; import { text } from 'unityengine ui'; import { worldservice } from 'zepeto world'; export default class getposition extends zepetoscriptbehaviour { public debugtext text; private zepetocharacter zepetocharacter; start() { zepetoplayers instance onaddedlocalplayer addlistener(() => { // get the zepetocharacter of the local player using their userid this zepetocharacter = zepetoplayers instance getplayer(worldservice userid) character; }) } update() { // update the debug text with the current player's position this debugtext text = "current player position " + this zepetocharacter transform position tostring(); } } ❗️ caution to use the getplayer() function in a multiplayer environment, you must use sessionid as a parameter 📘 please refer to the following guide \[ zepeto players docid\ hkhdijsc keifucm88qjq ] add a gameobject to the scene and rename it to characterposition add the written getposition zepetoscript, and connect a button ui to the property in the zepeto script inspector window by simply dragging and dropping it from the hierarchy window step 2 run when you press the play button, you can check the character's real time location through the text ui