java script problems

i am making a game and i am having scripting problems i want to make it so when var bullet is touching var self level 2 loads
my problem is:

Assets/scripts/touch.js(3,18): BCE0022: Cannot convert ‘UnityEngine.Quaternion’ to ‘UnityEngine.Transform’.

my code is:

var bullet : Transform;

var self : Transform;

self = transform.rotation;

transform.rotation = Quaternion.identity;

function update (){

if (self){ Application.LoadLevel(2); }

}

//please post a full script

When you have problem of this kind, for example cannot convert from to, then the bestway is to take a look on the Scripting Reference.

So let’s analize this problem together (I already I have the solution but I want to teach you how to solve this problems as you have negative Karma).

First of all take a look on Transform.Rotation
Now take a look on Quaternion.Identity

No we know the Transform.Rotation and Quaternion.Identity are both Quaternion type.
So where is the matter.
The matter is that you want to assign this value out of any function, that’s why you get this error.
you have to modify your script from:

transform.rotation = Quaternion.identity;
function Update (){
if (self){ Application.LoadLevel(2); }
}

to:

function Start () {
transform.rotation = Quaternion.identity;
}
function Update (){
if (self){ Application.LoadLevel(2); }
}