Question by
arthurptj · Nov 11, 2015 at 06:22 PM ·
errorparsing error
Parsing error,
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;
}
}
Comment
not positive or fluent in java but you don't have a class
using UnityEngine; using System.Collections;
Public class Whatever{
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; } }
}
Answer by Jessespike · Nov 11, 2015 at 07:03 PM
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;
}
}
Your answer
Follow this Question
Related Questions
Coding Errors 1 Answer
Parsing Error 0 Answers
parsing error 1 Answer
Parsing error and unexpected symbol 1 Answer