I want to go through a trigger so when i pass it i change the camera. I can do it one way, but now I wanna do it the other way around, if i go through the same trigger change the camera to the first one.
Camera1 ----Through trigger----> Camera2 /// Camera2 ----Through trigger-----> Camera1
All in the same trigger. I also need to change the tag to MainCamera everytime i swithc cameras, so that my raycasting from camera to mouse work.
I got this at the moment:
using UnityEngine;
using System.Collections;
public class ChangeCamera : MonoBehaviour
{
public Camera cam_1;
public Camera cam_2;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
}
void OnTriggerEnter ()
{
cam_1.enabled = !cam_1.enabled;
cam_2.enabled = !cam_2.enabled;
}
void OnTriggerExit ()
{
}
}