using System.Collections; using System.Collections.Generic; using UnityEngine; public class Rotate : MonoBehaviour { // Update is called once per frame public float m_Speed; private float m_X; private float m_Y; private float m_Z; public enum Axis { X, Y, Z } public Axis m_Axis; void Update() { float speed = -Time.fixedDeltaTime * m_Speed; m_X = 0; m_Y = 0; m_Z = 0; if (m_Axis == Axis.X) { m_X = speed; } else if (m_Axis == Axis.Y) { m_Y = speed; } else if (m_Axis == Axis.Z) { m_Z = speed; } this.transform.Rotate(m_X, m_Y, m_Z, Space.World); } }