unity使物体运行时自动旋转

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class jiaobeng : MonoBehaviour {

    public float speed = 80f;

    // Update is called once per frame
    void Update () {
        transform.Rotate(Vector3.up * Time.deltaTime * speed);
    }

}


需要将脚本挂在需要自动旋转的物体component上即可运行,可根据自己需要对脚本进行更改

 

猜你喜欢

转载自blog.csdn.net/aorilfj/article/details/127762648