'active' is not a member of 'System.Type'.

I’m trying to make an airbrake script. It should increase the drag on the rigidbody it’s attached to, and enable/disable a GO. Here’s the script.

var airbrake = GameObject;

function Start () {
airbrake.active = false;
rigidbody.drag = 0;
}

function Update () {
if(Input.GetKeyDown(KeyCode.LeftShift)){
airbrake.active = true;
rigidbody.drag = 10;
} else {
airbrake.active = false;
rigidbody.drag = 0;
}
}

Yet I get an error: ‘active’ is not a member of ‘System.Type’. But I’ve disabled/enabled gameobjects this way before, so why is it not working now?! I have a script doing a similar thing, that on key press, it deactivates stuff and enables stuff, but this doesn’t want to do it. HELP.

The problem is in your first line:

var airbrake = GameObject;

You’re literally setting airbrake to equal the GameObject class. (I’m not sure of your experience with programming, but if you don’t know what a class is, it would be a great idea to look it up)

This is the same issue that you would get if you did something like this:

GameObject.active = false; //should be gameObject.active = false

Tl;dr: I think you’ll want to replace your first line with this:

var airbrake : GameObject;

Change

var airbrake = GameObject;

to

var airbrake : GameObject;