I new to scripting and I made this script:
#pragma strict
public var hasKey : boolean;
public var hasLight : boolean;
public var hasportalgun : boolean;
private var portalgun : portal gun;
if (hasportalgun == true)
{
Camera.main.gameObject.GetComponent( portalgun ).enabled = true;
}
else
{
Camera.main.gameObject.GetComponent( portalgun ).enabled = false;
}
I was wondering why it states that “private var portalgun : portal gun;” (my attempt at referencing another script that is on my main camera) needs a semicolon while it already has one. I’m trying to activate a the “portal gun” script when boolean = true for it. This is all in unity script(javascript), and no, I’m not finished writing it, I’d just like to see how it works before having activate a flashlight and a light when haslight = true. I also have other script that work to turn the boolean true when the player “gets” the item.