unity之更改天空盒

 1 using UnityEngine;
 2 public class ConversionSkyBox: MonoBehaviour
 3 {
 4     public Material skyMats;//天空盒材质球
 5     private void OnEnable()
 6     {
 7         if (skyMats != null)
 8         {
 9             RenderSettings.skybox = skyMats;
10             //一定要加DynamicGI.UpdateEnvironment();,不然只是天空盒换了,效果还是之前的效果
11             DynamicGI.UpdateEnvironment();
12         }
13     }
14 }

 

posted @ 2023-05-04 11:37  赵不灰  阅读(115)  评论(0编辑  收藏  举报