按下某键 改变天空盒的颜色
1、建立一個 camera , GameObject-->Create other-->camera2、於camera建立一個 skybox ,component-->Rendering-->skybox
3、於main camera 也建立一個skybox
4、分別拉天空白天與黃昏材質球於camera、main camera的skybox
5、拉script於main camera , 再拉camera 物件於cammer
即可切換
以下是c# script 程式碼<p>using UnityEngine;
using System.Collections;</p>
<p>public class changesky : MonoBehaviour {</p>
<p>//宣告GameObject物件</p>
<p> public GameObject cammer;
private int sky = 0;</p>
<p> // Use this for initialization
void Start () {
}
//
Update is called once per frame
void Update()
{
if
(Input.GetKeyDown(KeyCode.A))
{
sky++;
if (sky == 1)
{
cammer.SetActiveRecursively(false);
}
else if (sky == 2)
{
cammer.SetActiveRecursively(true);
}</p>
<p> if (sky == 3)
{
sky =
0;
}
}
}
}</p> 好帖就是要顶 顶顶多好 说的非常好 很好哦 不错不错 楼主是超人 顶顶多好 真心顶 很好哦