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

Object reference not set to an instance of an oboject?,Object reference not set to an instance of an object

$
0
0
Hello, I have this code and for some reason this error message comes up: "Object reference not set to an instance of an oboject". Does anyone know why its there and how to fix it? heres my code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class PhysicsObject : MonoBehaviour { public float gravityModifier = 1f; protected Rigidbody2D rb2d; protected Vector2 velocity; void onEnable() { rb2d = GetComponent (); } // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { } void FixedUpdate() { velocity += gravityModifier * Physics2D.gravity * Time.deltaTime; Vector2 deltaPosition = velocity * Time.deltaTime; Vector2 move = Vector2.up * deltaPosition.y; Movement (move); } void Movement(Vector2 move) { rb2d.position = rb2d.position + move; } },Hello, I found this code and for some reson this error message comes up. Does anyone know why its there and how to fix it?

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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