I’m coding a 2D game where i need my character to jump I’ve made this code but i keep getting this error.
using UnityEngine;
using System.Collections;
public class Jumping : MonoBehaviour {
private int jumpHeight = 50;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetButtonDown("Jump") || Input.GetKey ("w")) {
playerJump();
}
}
void playerJump(){
Rigidbody2D.AddForce(new Vector3(0, jumpHeight,0), ForceMode.Force);
}
}