Skip to content

Instantly share code, notes, and snippets.

@tsubaki
Created April 22, 2018 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsubaki/7c0f268844467e51016a20632176a337 to your computer and use it in GitHub Desktop.
Save tsubaki/7c0f268844467e51016a20632176a337 to your computer and use it in GitHub Desktop.
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