Problem getting GetComponent to work

hello, i just had a quick question.
i am trying to access a variable from a script attached to my main camera here is the code.

Camera.main.GetComponent<camera>().target = myship.transform;

i have tried multiple different ways and it still comes up with this error.

Assets/Scripts/NetworkManager.cs(25,42): error CS0246: The type or namespace name `camera’ could not be found. Are you missing a using directive or an assembly reference?

can someone tell me what i am doing wrong.

thank you,
mewhy

try this

if u have a gameobject named “Camera” and script named “camera”

GameObject MyCamera = GameObject.Find ("Camera"); //fetch the object
if (MyCamera==null) print ("Could not find the object Camera"); 
camera cameraScript = MyCamera.GetComponent<camera>(); // this is mainly to check what is your problem
if (camera==null) print ("Cant find my script camera");  // use this line OR the next line
MyCamera.GetComponent<camera>().target = myship.transform; // or use this line this is your line
// camera.target = myship.transform // if you have the script like here in this exmaple.

after this you should be able to understand where is your problem. good luck.

HEY I GOT IT!!! read this and you will see what my problem was. http://docs.unity3d.com/Documentation/ScriptReference/index.Script_compilation_28Advanced29.html