Advertisement
Guest User

Untitled

a guest
Jan 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.40 KB | None | 0 0
  1. public class CamChangerSpace : MonoBehaviour {
  2.     public Camera Cam1White, Cam2Black;
  3.     public KeyCode space;
  4.     public bool camSwitch = false;
  5.  
  6.     void Update()
  7.     {
  8.          if (Input.GetKeyDown("space"))
  9.          {
  10.             MyButtonMethod();
  11.          }
  12.     }
  13.  
  14.     public void MyButtonMethod()
  15.     {
  16.         camSwitch = !camSwitch;
  17.         Cam1White.gameObject.SetActive(camSwitch);
  18.         Cam2Black.gameObject.SetActive(!camSwitch);
  19.     }
  20.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement