using UnityEngine;
using System.Collections;
#pragma strict
public var one : Camera ;
public var two : Camera ;
function Start() {
one.Camera.enabled = true;
two.Camera.enabled = false;
}
function Update() {
if(Input.GetButtonDown("switch"))
{
one.Camera.enabled = !one.Camera.enabled;
two.Camera.enabled = !two.Camera.enabled;
}
}
Use import instead of using
Cameras don’t have a public static Camera property.
import UnityEngine;
import System.Collections;
#pragma strict
public var one : Camera ;
public var two : Camera ;
function Start() {
one.enabled = true;
two.enabled = false;
}
function Update() {
if(Input.GetButtonDown("switch"))
{
one.enabled = !one.enabled;
two.enabled = !two.enabled;
}
}