Get rotation of an Object.

I want to get rotation of an Object.

using UnityEngine;
using System.Collections;

public class RocketCon : MonoBehaviour {
	public float speed;
	public float rotationspeed;
	public GameObject Tow;
	public float RocketMass;
	public float rotation;
	public float Nowrotation;
	public float changerotation;

	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {
		RocketMass = GetComponent<Rigidbody2D>().mass;
                // ERROR
		Nowrotation =  gameObject.transform.rotation;
                // ERROR
		rotation = Nowrotation + changerotation; 
        transform.rotation = Quaternion.Euler(0, 0, rotation);
		if (Input.GetKey("w"))
			GetComponent<Rigidbody2D>().AddForce((Tow.transform.position - transform.position) * speed );			
		if (Input.GetKey("q"))
            changerotation +=  rotationspeed / RocketMass;	
		if (Input.GetKey("e"))
		    changerotation -=  rotationspeed / RocketMass;		

Than i get :
error CS0029: Cannot implicitly convert type UnityEngine.Quaternion' to float’

A rotation is not held within a float. Rotations are stored in a Quaternion, which is similar to a Vector4. Therefore, you should change Newrotation to be a Quaternion at the top of your script.

Also, you cannot add rotations (which you are doing the line below your error). You want to actually multiply them. To subtract quaternions, you would multiply by the inverse.

Let me know if I’m correct. Also, let me know if this fixed your problem.