UnityScript error in transform.Position

Hi,
This has probably been asked a million times already but i cant seem to find the answer anywhere.
I am trying to write a script so that my camera moves to a new angle when a button is pressed, however i keep getting the error :"An instance of type 'UnitEngine.Component is required to access non static member ‘transform’. I get this error with both the rotation and position of the camera. This is my code:

var camera = GameObject.Find("Camera");
function Update() {
	if (Input.GetKeyDown(KeyCode.D))
		{
		Camera.transform.Position = Vector3(0,11,17.78);
		Camera.transform.Rotation = Vector3(0,180,40);
		}
}

Hope anyone can help me with htis and thanks in advance :slight_smile:

Hm first I would attach this code right on to the camera, so you dont have to use “var camera = GameObject…” instead you can just use “transform.position”. Everything in line 5 looks okay you just have to make the p in position lowercase. As for line 6 try using “EulerAngles” instead of Rotation. Hope this helps!

function Update () {
if(Input.GetKeyDown(KeyCode.D))
{
transform.position = Vector3(0, 11, 17.78);
transform.EulerAngles = Vector3(0, 180, 40);
}
}

You need to pay attention to spelling and capitalization. You have a variable called “camera” but you’re referring to “Camera”, which are two different things. If you look in the docs, you can see that there are no properties of Transform called “Rotation” or “Position”. (Also, Transform.rotation is a quaternion and does not take a Vector3.)