Quaternion.Lerp problem

Hi.

I used below code and want when press right key, my object rotate to y axis with Quaternion.Lerp.

Quaternion rotation = Quaternion.Lerp (transform.rotation, new Quaternion.Euler(transform.rotation.x, 360f, transform.rotation.z), Time.deltaTime * speed);

but unity give me this error:

error CS0029: Cannot implicitly convert type UnityEngine.Quaternion' to UnityEngine.Transform’

does anyone know how can fix it?

Thanks.

The error message you posted can’t belong to this line of code. The error said that you try to assign a Quaternion value to a variable / property of type “Transform”.

You probably did something like

transform = rotation;

instead of

transform.rotation = rotation;