Getting Started

Creating a Zepeto character

17min

STEP 0 : Adding a Base to the Scene

  • In the Hierarchy window, click on 3D Object → Plane.
Document image

  • 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.
Document image


👍 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.

Document image


An object called ZepetoPlayers will be automatically created as shown below. ZepetoPlayers is a component that manages character controller modules within the World.

Document image




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



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.

Document image




2) When the ZEPETOScript file is created, please enter the name as CharacterController. A script file will be created as shown below.

Document image




3) In the Hierarchy → [+] menu → run the Create Empty menu.

Document image




4) When creating an Empty GameObject, write CharacterController. A GameObject will be created as shown below.

Document image




5) Drag the previously created CharacterController ZEPETOScript file onto the GameObject as a Component.

Document image

  • 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


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

  • 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.

Document image


👍 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.
Document image




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




Use the Play button in the center of the screen to check the creation of the character.

Document image




If you change the position and orientation values, you can also create a character lying down like this.

SpawnInfo Sample

Document image