Question by
SaveOneMore777 · Feb 12, 2016 at 06:55 PM ·
switch cameras
Change Cameras on Collision (Javascript)
I'm not too familiar with Javascript but all of the resources that I found were in Javascript. I am trying to switch cameras once my player hits a cube with the "End" tag. I attached this script to my player, but there is no switch. It just stays on cam1. My script is below.
#pragma strict
var cam1: Camera;
var cam2: Camera;
function Start () {
cam1.enabled=true;
cam2.enabled=false;
}
function OnTriggerEnter(other:Collider) {
if (other.tag == "End") {
cam1.enabled=false
cam2.enabled=true
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612063946im_/https://answers.unity.com/themes/thub/images/avi.jpg)