GetComponent replacement does not work

Hi,

I am quite new to Unity and there is a problem I have:
There are a couple of scripts that communcate to each other often, so I have to get values of variables in other scripts, call methods, and so on. For now, I have always written the calls like this:

gameObject.GetComponent(“…scriptName…”).doSomething();

Now the code has become long and longer and for performance issues and better readable code, I wantet to define variables at the beginning:

private var abc : Component;
abc = gameObject…GetComponent(“…scriptName…”);

abc.doSomething();

But the Compiler tells me, that doSomething is not a member of abc.
What am I doing wrong?

Solved my problem with help of the documentation. :slight_smile:

Thread can be closed.