Hey there,
I’m pretty new to this Unity stuff and C#, I’m still learning. I’ve had a google, but I’ve had no luck finding what I need. Basically, I’m having an issue in line 22. The issue is as follows,
error CS010: An object reference is required to access non-static member `UnityEngine.Rigidbody.AddForce(UnityEngine.Vector3, UnityEngine.ForceMode)’
I understand what it means I think, but unsure how I can actually fix the issue. Below, is my entire script and I hope you guys can help me out. Thanks! Also would be great, if you can spot any other issues…
using UnityEngine;
using System.Collections;
public class Jump : MonoBehaviour {
//Controls Player Jump Height
private int jumpHeight = 500;
void Start () {
}
void Update () {
if (Input.GetButtonDown("Jump") || Input.GetKey ("w")) {
DoJump();
}
}
void DoJump (){
Rigidbody.AddForce(new Vector3(0, jumpHeight,0), ForceMode.Force);
}
}