Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

How can i use temp variables?.

$
0
0
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][1]. [1]: http://www.youtube.com/watch?v=PazLGgeFkHI&list=PLPV2KyIb3jR4u6zeBY77WPj0KuFdmv84g&index=3

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>