The ZEPETO camera is set to follow the player's ZEPETO character.
This guide will show you how to prevent the ZEPETO camera from following your ZEPETO character at runtime.
Step 1 : Write a script
- Add a GameObject to the Scene and include the RuntimeCamera example script below.
import { ZepetoScriptBehaviour } from 'ZEPETO.Script';
import { ZepetoCamera, ZepetoPlayers } from 'ZEPETO.Character.Controller';
import { Button } from 'UnityEngine.UI';
export default class RuntimeCamera extends ZepetoScriptBehaviour {
public turnOnBtn: Button;
public turnOffBtn: Button;
private _myCamera: ZepetoCamera;
Start() {
ZepetoPlayers.instance.OnAddedLocalPlayer.AddListener(() => {
this._myCamera = ZepetoPlayers.instance.LocalPlayer.zepetoCamera
});
this.turnOffBtn.onClick.AddListener(() => {
this._myCamera.StateMachine.Stop();
});
this.turnOnBtn.onClick.AddListener(() => {
this._myCamera.StateMachine.Start(this._myCamera.currentState);
});
}
}
Step 2 : Run
- If you press the Pause button, you will notice that the ZEPETO camera no longer follows the player character and remains fixed in place.
- When you press the Resume button, you can see that the camera follows the character again.