可自行修改绕不同轴进行旋转
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Stateother : MonoBehaviour
{
private GameObject Player;
private GameObject Food;
private int time = 1;
private int speed=1;//可修改
// Start is called before the first frame update
void Start()
{
Player = GameObject.Find("player");
Food = GameObject.Find("littlefood1");
}
// Update is called once per frame
void Update()
{
time++;
Food.transform.rotation = Quaternion.Euler(0, time*speed, 0);
}
}