A Javascript trying to access an image effect C# script

I’m just trying to get access to the color correction curve script (C#) that is attached to the main camera with my PlayerMovement script (JavaScript). I keep getting the error not member of object.

#pragma strict

var Speed : float;
var colorCorrection;
private var Movement : Vector3;
var RB2D : Rigidbody2D;

function Start () 
{
	colorCorrection = Camera.main.GetComponent("ColorCorrectionCurves");
	RB2D = GetComponent(Rigidbody2D);
}

function FixedUpdate () 
{
	if (Input.GetKey("d"))
	{
		Movement = new Vector3 (1.0f, 0.0f, 0.0f);
		RB2D.AddForce (Movement * Speed);
	}

	if (Input.GetKey("a"))
	{
		Movement = new Vector3 (1.0f, 0.0f, 0.0f);
		RB2D.AddForce (Movement * -Speed);
	}
}

function OnTriggerEnter2D(other : Collider2D)
{
	if (other.gameObject.tag == "ImageWall")
	{
		colorCorrection.enabled = false;
	}
}

Thank you in advance.

Hi,

The problem here is that you are trying to change the value of enabled on what Unity considers an Object. This can be fixed by changing this:

var colorCorrection;

to this:

var colorCorrection : Behaviour;

I hope this helps!