using UnityEngine; public class AutoRotate : MonoBehaviour { bool _rotation = false; public bool Rotation { get { return _rotation; } set { _rotation = value; } } Vector3 _dir; float _rotationSpeed = 8f; public void StartRotate() { _dir = new Vector3(0, 0, 0); } void Update() { if (_rotation == true) { //print("Update22222"); transform.LookAt(_dir); transform.RotateAround(_dir, Vector3.up, _rotationSpeed * Time.deltaTime); } } public void ToggleAutoCameraRotation() { _rotation = !_rotation; } public void StopAutoCameraRotation() { _rotation = false; } }