GetComponent Errors

Hello there, I had been struggling with unitys GetComponent for quiet some time now.

Code:

        ScriptABC abc = (ScriptABC) collidedObject.collider.gameObject.GetComponent(typeof(ScriptABC));

When i use the above line in collision detection code, all i get is the below error :(

Cannot convert type 'UnityEngine.Component' to 'ScriptABC'

ScriptABC is not a Monobehavior and I want to access some methods exposed in that script.

abc.GetLife() and so on

This error doesnt leave me to proceed !

Any ideas?

Thanks folks!

Make sure your ScriptABC really inherits from MonoBehaviour.

class ScriptABC : MonoBehaviour
{
    //...
}

Lose the typeof().

UnityScript:

ScriptABC abc = collidedObject.collider.gameObject.GetComponent(ScriptABC);

C#:

ScriptABC abc = collidedObject.collider.gameObject.GetComponent<ScriptABC>();