C# GetComponent Issue

GameObject camera = gameObject.Find(“PlayerCamera”);
PlayerCamera cameraScript = camera.GetComponent();
cameraScript.snapToBack();

I don’t understand why this isn’t compiling -_-
The compiler says “type or namespace PlayerCamera cannot be found” on
the PlayerCamera cameraScript line.

If the PlayerCamera script is javascript, you will need to put it in the correct file directory.

If PlayerCamera is C#, put it in the same folder as this script.

Don’t put quotes in the type specifier; you meant this:

PlayerCamera cameraScript = camera.GetComponent<PlayerCamera>();