Created
April 22, 2018 15:08
-
-
Save tsubaki/7c0f268844467e51016a20632176a337 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class SwitchGameObject : MonoBehaviour | |
{ | |
[SerializeField] GameObject targetCamera, mainCamera; | |
void OnTriggerEnter(Collider other) | |
{ | |
targetCamera.SetActive(true); | |
mainCamera.SetActive(false); | |
} | |
void OnTriggerExit(Collider other) | |
{ | |
targetCamera.SetActive(false); | |
mainCamera.SetActive(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment