GetComponent not working normally.

This is part of the script attached to my character

var sceneManager : GameObject;

function OnTriggerEnter2D(other : Collider2D)
{
	if(other.tag == "Enemy")
	{
		print("hit");
            //**THIS FOLLOWING LINE IS THE ERROR LINE**
		sceneManager.transform.GetComponent("SceneManagerScript").Point();
	}
}

the console give me the following error BCE0019: ‘Point’ is not a member of ‘UnityEngine.Component’.

This is attached to the sceneManager
#pragma strict
var counter : int = 0;

function Update () 
{
	print(counter);
}

function Point()
{
	counter += 1;
}

I know how to work around this problem, that’s not what I’m looking for though. I WANT to know why this doesn’t work when it should. I saw this in a tutorial video and it worked just fine. Thanks in advance.

It doesn’t work because you are using the string version of GetComponent - you should avoid that unless you happen to have a component type stored in a variable. When you use that version you get back a Component that you must cast to the correct type. You’d be better off using the version of GetComponent which just takes the class.

 sceneManager.transform.GetComponent(SceneManagerScript).Point();

Or

 (sceneManager.transform.GetComponent("SceneManagerScript") as SceneManagerScript).Point();