An instance of type 'UnityEngine.Transform' is required to access non static member, Error in script

Hello!

So i have thise pice of code that i was looking in to and now i get a few errors.

Heres the code that i have:

var LookAtTarget:Transform;

var damp = 2.0;

var bullitPrefab:Transform;

var savedTime=0;

function Update() {

if(LookAtTarget){

var rotate = Quaternion.LookRotation(LookAtTarget.position - Transform.Position);

Transform.rotation = Quaternion.Slerp(UnityEngine.Transform.rotation,rotate,Time.deltaTime * damp);

var seconds : int = Time.time;

var oddeven = (seconds % 2);

if(oddeven){



	Shoot(seconds);



	}

}

}

function Shoot(seconds)

{

if(seconds!=savedTime){

var bullit = Instantiate(bullitPrefab ,Transform.Find("Spawn").transform.position,

Quaternion.identity);

bullit.rigidbody.AddForce(transform.forward*1000);





savedtime=seconds;

}

}

Here are the errors:

Assets/Shooting.js(19,19): BCE0020: An instance of type ‘UnityEngine.Transform’ is required to access non static member ‘rotation’.

Assets/Shooting.js(19,69): BCE0020: An instance of type ‘UnityEngine.Transform’ is required to access non static member ‘rotation’.

Assets/Shooting.js(34,58): BCE0020: An instance of type ‘UnityEngine.Transform’ is required to access non static member ‘Find’.

So i dont understan what i have to do, i tried to put UnityEngine.Transform.rotation but it did not work, what to do?

I have a littlebit of experience with java but this i dont understand, please help! Thank youu!

Transform is the name of the class, what you probably want is the transform property, which will access the Transform component of the GameObject that has your script attached.

If you’re new to Unity, take a look at the documentation, and try the tutorials.