Accessing script on Camera from seperate script

Hello fellow coders, I have an annyoing problem in my script.

I want to access a function that is included in script “map” which is attached to the “Camera1Map” Camera, but it just gives me an error message.

First I set up the camera as a GameObject, but I guess Unity doesn’t regard Cameras as GameObjects but rather as… Cameras :slight_smile:
So I changed the variable setup and Gameobject.Find routines to use it as a Camera, and so far it works. Upon starting, it correctly finds the Camera1Map as a camera.

Now I want to access the function MoveNorth() inside the script “map” attached to the camera.

Error message:

No appropriate version of ‘UnityEngine.Component.GetComponent’ for the argument list ‘(function(Object, Function): System.Collections.IEnumerable)’ was found.

var Player1MapCamera : Camera;
Player1MapCamera = GameObject.Find("Camera1Map").camera;

Player1MapCamera.GetComponent(map).MoveNorth();

Error line is the last one. It compiles without problems if I comment out the line.

I assume I have to add “.Camera” somewhere in the GetComponent line, or maybe it’s another problem altogether?

Thanks in advance for any advice.

There is no problem with the syntax you implemented. Have you double checked the Uppercase/Lowercase spelling of your functions and scripts?