Getting Started

Creating a Zepeto character

17min
step 0 adding a base to the scene in the hierarchy window, click on 3d object → plane set the position of the plane to x 0, y 0, z 0, and set the size big enough to x 10, y 1, z 10 👍 tips the plane is the most basic floor for testing purposes it does not matter what you use as long as it is an object with a collider as you become more familiar with world creation, you can make a cool map to replace the floor without a platform, the character will fall as soon as it is created and will not be visible step 1 adding the zepeto players component in the hierarchy window, select zepeto → zepetoplayers tab an object called zepetoplayers will be automatically created as shown below zepetoplayers is a component that manages character controller modules within the world set values for character control and related functions can be set in the inspector window you can usually set up things like the zepeto camera settings, character movement speed, jump height, etc in this example, we will use the default values 📘 for detailed settings, please refer to the zepeto character controller guide zepeto character controller docid\ xhnar7turm4n09jqpqq5m step 2 to load character to load a character, you need to create a new zepetoscript file 1\) in the \[project] panel, select the \[+] menu in the top left corner or select assets → create → zepeto → typescript 2\) when the zepetoscript file is created, please enter the name as charactercontroller a script file will be created as shown below 3\) in the hierarchy → \[+] menu → run the create empty menu 4\) when creating an empty gameobject, write charactercontroller a gameobject will be created as shown below 5\) drag the previously created charactercontroller zepetoscript file onto the gameobject as a component zepetoscript will not run unless it is added as a component to a gameobject in the scene 6\) first, enter your zepeto id to load the character into the scene open the charactercontroller zepetoscript file and run the script editor program then apply the example script below please enter your zepeto id where it says \[zepeto id] if your zepeto id is 'abcd', you should enter it as zepetoplayers instance createplayerwithzepetoid("", "abcd", new spawninfo(), true) script for loading a zepeto character with a specific zepeto id script for loading a zepeto character with a specific zepeto id import { zepetoscriptbehaviour } from 'zepeto script'; import { spawninfo, zepetoplayers, localplayer } from 'zepeto character controller'; export default class characterloader extends zepetoscriptbehaviour { start() { zepetoplayers instance createplayerwithzepetoid("", "\[zepeto id]", new spawninfo(), true); zepetoplayers instance onaddedlocalplayer addlistener(() => { const player localplayer = zepetoplayers instance localplayer; }); } } 7\) after saving the script, please return to the unity editor please move on to the execution of step 3 if you use this code, you will only play with the avatar of a specific zepeto id when you launch your world, you will need to modify your code to be based on the zepeto id of the user who accessed your world, instead of the zepeto id you entered in your code please use the script below script for loading the character of the logged in id script for loading the character of the logged in id import { zepetoscriptbehaviour } from 'zepeto script'; import { spawninfo, zepetoplayers, localplayer, zepetocharacter } from 'zepeto character controller'; import { worldservice } from 'zepeto world'; export default class characterloader extends zepetoscriptbehaviour { start() { // grab the user id specified from logging into zepeto through the editor zepetoplayers instance createplayerwithuserid(worldservice userid, new spawninfo(), true); zepetoplayers instance onaddedlocalplayer addlistener(() => { const player localplayer = zepetoplayers instance localplayer; }); } } this script creates a zepeto character based on the logged in id and does not accept a specific zepeto id, so make sure to log into the unity editor before testing after saving the script, please return to the unity editor please move on to the execution of step 3 please make sure that there is only one local player creation code in the client script if multiple identical players are created, the createplayerwithuserid() script may be being called elsewhere a common mistake is to apply the multiplayer example code while leaving the character creation code in this guide intact, resulting in the character being created twice please manage this by commenting out one side step 3 run use the \[▶︎(play)] button at the center of the screen to check that the charactercontroller is working properly the loaded character is referred to as the local player's character, which means the zepeto character that users can control directly on their own devices charactercontroller has a common character control key mapping for each input event corresponding to the device (pc/mobile) thus, the loaded character can be controlled in a scene regardless of the platform on a pc, characters and cameras can be operated with a mouse on a mobile device, characters and cameras can be operated with a virtual pad as shown in the screenshots below 👍 the following input interfaces are supported for character control pc move keyboard arrows, wasd jump space double jump (left) shift zoom mouse wheel rotate screen drag mobile move (bottom left screen)virtual pad jump (bottom right screen)virtual pad button zoom (two fingers)screen drag rotate (one finger)screen drag if the zepeto character creation is not functioning properly, please go to unity menu > project settings > editor > enter play mode settings set the enter play mode options to off step 4 change the start position of the zepeto character the start position of the zepeto character is created at unityengine vector3(0,0,0) unless otherwise set the rotation value is also generated at an angle of unityengine quaternion euler(0,0,0) the character spawn position and rotation values are set using zepetoplayers instance createplayerwithuserid(worldservice userid, new spawninfo(), true); the function's argument, spawninfo(), will be generated so you can set the desired value for spawninfo() before calling the character creation function to make sure it spawns at a specific location we have pre placed a 3d object > cube at location (0,0,0) on the map if you change the spawn location value for the character to the following, it will spawn on top of the cube charactercontroller import { zepetoscriptbehaviour } from 'zepeto script'; import { spawninfo, zepetoplayers, localplayer, zepetocharacter } from 'zepeto character controller'; import { worldservice } from 'zepeto world'; import { quaternion, vector3 } from 'unityengine'; export default class charactercontroller extends zepetoscriptbehaviour { start() { // set character spawn position const spawninfo = new spawninfo(); spawninfo position = new vector3(0,2,0); // set character spawn rotation spawninfo rotation = quaternion euler(0,0,0); // grab the user id specified from logging into zepeto through the editor zepetoplayers instance createplayerwithuserid(worldservice userid, spawninfo, true); zepetoplayers instance onaddedlocalplayer addlistener(() => { const player localplayer = zepetoplayers instance localplayer; }); } } use the play button in the center of the screen to check the creation of the character if you change the position and orientation values, you can also create a character lying down like this spawninfo sample // set character spawn position const spawninfo = new spawninfo(); spawninfo position = new vector3(2,1,2); // set character spawn rotation spawninfo rotation = quaternion euler(90,0,0);