How can i use temp variables?.

hello, i’m new to unity as a whole, and am currently following a set of tutorials online, however, there is a problem i have run into, the tutorials use unityscript, i am using C#, so because of this, i’ve run into a translation issue with a script, i am given the following error message:

Assets/Movement.cs(20,35): error CS1612: Cannot modify a value type return value of `UnityEngine.Rigidbody.velocity’. Consider storing the value in a temporary variable

here is the script:

    using UnityEngine;
    using System.Collections;
    public class Movement : MonoBehaviour
    	public float rotationSpeed;
    	public float jumpHeight;
    	private bool isFalling = false;
    	void Update ()
    		//Handle ball rotation.
    		float rotation = Input.GetAxis ("Horizontal") * rotationSpeed;
    		rotation *= Time.deltaTime;
    		rigidbody.AddRelativeTorque (Vector3.back * rotation);
    		if (Input.GetKeyDown (KeyCode.W))
    			rigidbody.velocity.y = jumpHeight;

being new to unity, i’m at a total loss as to what i should do, or what a temp variable is.

the tutorial is here.

If you don’t understand C# is a good sign to stay in unity script :stuck_out_tongue:

The error said everything that you need.

var v = rigidbody.velocity; // temp!!!!!
v.x = 1;
rigidbody.velocity =  v;

I don’t know if you can change rigidbody.velocity directly, use the method AddForce is the default.