unity3D skybox


1、建立一個 camera , GameObject-->Create other-->camera
2、於camera建立一個 skybox ,component-->Rendering-->skybox
3、於main camera 也建立一個skybox
4、分別拉天空白天與黃昏材質球於camera、main camera的skybox
5、拉script於main camera , 再拉camera 物件於cammer
即可切換
以下是c# script 程式碼
using UnityEngine;

using System.Collections;
public class changesky : MonoBehaviour {
  //宣告GameObject物件
    public GameObject cammer;

    private int sky = 0;
// 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(***e);

            }
            if (sky == 3)

            {

                sky = 0;

            }

                  

        }

      

    }



}

转载于

unity天空变换代码
http://www.narkii.com/club/thread-261688-1.html

原文地址:https://www.cnblogs.com/ShineaSYR/p/5417219.html