在主相机上加skybox组件,赋加修改的天空。加skyrotate脚本在主相机上
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class skyRotate : MonoBehaviour
{
private void Update()
{
RotateSkybox();
}
//控制天空盒旋转
private void RotateSkybox()
{
/*
float num = RenderSettings.skybox.GetFloat("_Rotation");
RenderSettings.skybox.SetFloat("_Rotation", num + 0.05f);
*/
float num = Camera.main.GetComponent<Skybox>().material.GetFloat("_Rotation");
Camera.main.GetComponent<Skybox>().material.SetFloat("_Rotation", num + 0.05f);
}
}