zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    Unity SceneManager 对场景的操作
    Unity [Tooltip("")]
    Unity WWW下载图片并保存到Unity的Assets下
    C# 集合
    C# 枚举与switch用法
    C# String.Format方法
    C# Thread类 线程优先级
    Unity Gizmos可视化辅助工具
    anacanda
    异常和错误
  • 原文地址:https://www.cnblogs.com/ShineaSYR/p/5417219.html
Copyright © 2011-2022 走看看