Implementing an object that follows the character
Using the NavMeshAgent component, you can create an AI object that follows your ZEPETO character.
In this guide, we’ll create a Pet object that follows your character.
Open the Navigation (Obsolete) Window.

In the Unity top menu, click Window > AI > Navigation (Obsolete) to open the Navigation (Obsolete) window.
Define movable areas for the Pet object.

In the Navigation (Obsolete) window, click the Object tab. From the Hierarchy, select floors, walls, and obstacles that will be included in the NavMesh, and add them as Objects.
- This sets them as navigable surfaces or obstacles for the Pet object.
Make sure the Navigation Static field is checked.
✏️ For more details on NavMesh, please refer to the video below.
Bake the NavMesh.

Click the Bake tab, then click the Bake button to generate the NavMesh.
Create a NavMeshAgent.
Select the Pet object in the Hierarchy. In the Inspector, add the NavMeshAgent component.
- An Agent refers to the Pet object navigating through the NavMesh system.
You can adjust attributes like size, speed, rotation speed, acceleration, and obstacle height recognition.
✏️ For more details on NavMeshAgent, please refer to this link.

In this example, we set the NavMeshAgent’s Stopping Distance to 3, so the Pet stops at a distance of 3 from the player.
Create a PetController script.
In the Project window, click + button > ZEPETO > TypeScript to create a new Zepeto script and rename it to PetController.
Then open the script and copy-paste the code below.
Script Explanation
- When the script starts, the _target is assigned as your ZEPETO character.
- In the Update function, every frame the NavMeshAgent’s SetDestination function sets your character’s position as the navigation target.
Apply PetController script to Pet object.
Select the Pet object in the Hierarchy. In the Inspector, click Add Component > Zepeto Script, then drag and drop the created PetController script into the Script field.
Press the Play button.

You can now see the Pet object following your character while avoiding obstacles like walls.
If you want the Pet to be attached to your character’s body rather than following, you can use object attachment.
✏️ For more details on object attachment, please refer to Attaching objects to ZEPETO characters guide.
Create an AttachPetController script.
In the Project window, click + button > ZEPETO > TypeScript to create a new Zepeto script and rename it AttachPetController.
Open the script and copy-paste the code below.
Script Explanation
- When the script starts, it finds the local player and its animator component.
- It identifies the body part selected in the bodyBone variable within the character’s animator.
- Then, it instantiates the pet object at the identified position, setting the pet object’s parent as the character’s body part.
Apply AttachPetController script to a new object.
In the Hierarchy, click + button > Create Empty to create a new object and rename it AttachPetController.
In the Inspector, click Add Component > Zepeto Script and drag-and-drop the AttachPetController script to the Script field.
Drag-and-drop the Pet object into the Pet field. Open the dropdown menu in the bodyBone field and select the character’s body part to attach the Pet object.

Press Play to see the Pet object appear attached to the selected body part.