CS0120 an object reference is required for the non static field, method or property "Rigidbody2D.velocity and warning CS0642

  • Thread starter Thread starter Programmer13
  • Start date Start date
P

Programmer13

Guest
I am a beginner at programing and making games{THIS IS MY FIRST CODE THAT I AM HAVING PROBLEM WITH}Please help--I AM USING UNITY VERSION 2018.3.0f2 personal and my visual studio version is 15.9.4

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
public float MoveSpeed;
public float JumpHeight;
// Start is called before the first frame update
void Start()
{

}

// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.Space));
{
Rigidbody2D.velocity = new Vector2(0, JumpHeight);
}
}
}

Continue reading...
 
Back
Top