Shamba

skybox_control

Mar 12th, 2018
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Skybox_control : MonoBehaviour {
  6.     public Material[] skyboxes;
  7.  
  8.     private void OnTriggerEnter(Collider other)
  9.     {
  10.         if(other.tag == "Player")
  11.         {
  12.             switch (this.gameObject.tag)
  13.             {
  14.                 case "sky1":
  15.                     RenderSettings.skybox = skyboxes[0];
  16.                     break;
  17.                 case "sky2":
  18.                     RenderSettings.skybox = skyboxes[1];
  19.                     break;
  20.             }
  21.         }
  22.     }
  23. }
Add Comment
Please, Sign In to add comment