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

Error CS0120 : An object reference is required to access non-static member

$
0
0
**In trying to make a jumping script in C#, I ran across this error:** *error CS0120: An object reference is required to access non-static member `UnityEngine.Rigidbody.velocity'* **This is my program:** using UnityEngine; using System.Collections; public class Jump : MonoBehaviour { public float JumpHeight = 8.0f; private bool isFalling = false; void Update () { bool jump = Input.GetAxis("Jump") != 0; if (jump && isFalling == false) { Vector3 velocity = Rigidbody.velocity; velocity.y += JumpHeight; Rigidbody.velocity = velocity; isFalling = true; } } void OnCollisionStay () { isFalling = false; } } **It would be very helpful if you could help me...** **Thanks**

Viewing all articles
Browse latest Browse all 7934

Trending Articles



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