Mono Develop problems "cant use GetComponent"

Hi, at PC I’m using VS and I never had a problem like this before but I cant find a good alternative for a MAC to use instead of mono.

error CS1061: Type UnityEngine.GameObject[]' does not contain a definition for GetComponent’ and no extension method GetComponent' of type UnityEngine.GameObject’ could be found (are you missing a using directive or an assembly reference?)

Mono keep giving random errors like these. Cant find basic fucntions and components of unity like GameObject.Find, GetComponent etc etc.

Is there a solution for this ?

The error message suggests that you are trying to access a GameObject array (the square brackets at the end of “Type UnityEngine.GameObject” means that the type you are accessing is a GameObject array). Assuming the object you are trying to GetComponent from is called myObject, try:

myObject[0].GetComponent<T>();

This accesses a single element in the array which will be of type GameObject. It is inside this object that GetComponent, Find, etc, exist.

Hope this helps =).

GameObject.FindGameObjectWithTag(“MainCamera”).GetComponent().target = mouselook;

GetComponent()

The compiler has no idea what type of component you want.

A good compiler doesn’t throw errors at random times, it throws them when you give it code with errors. I’m not saying MonoDevelop is a good compiler, but I didn’t think it was that bad.