Files
test/Assets/Jianghu/Scripts/AxisRotate.cs
T
vuong dinh hoang 8ba1f5fa6c for TiT
2026-05-06 15:15:45 +07:00

22 lines
608 B
C#

using UnityEngine;
[ExecuteAlways] // <-- this is the key
public class AxisRotate : MonoBehaviour
{
[Header("Rotation Speed (degrees per second)")]
public float xSpeed = 0f;
public float ySpeed = 0f;
public float zSpeed = 0f;
[Header("Space")]
public Space rotationSpace = Space.Self;
void Update()
{
// Use different delta time depending on mode
float delta = Application.isPlaying ? Time.deltaTime : Time.unscaledDeltaTime;
Vector3 rotation = new Vector3(xSpeed, ySpeed, zSpeed);
transform.Rotate(rotation * delta, rotationSpace);
}
}