TransformRotater.cs 466 B

123456789101112131415161718192021222324
  1. using UnityEngine;
  2. /// <summary>
  3. /// UI使用-自动旋转脚本
  4. /// </summary>
  5. public class TransformRotater : MonoBehaviour
  6. {
  7. /// <summary>
  8. /// 旋转速度
  9. /// </summary>
  10. public Vector3 angleSpeed;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. }
  15. // Update is called once per frame
  16. void Update()
  17. {
  18. transform.localRotation *= Quaternion.Euler(angleSpeed * Time.deltaTime);
  19. }
  20. }