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

How do i fix this nullreferenceException

$
0
0
Hi, i am very new to unity and i just tried to make a block dodge game posted to youtube (Brackeys https://www.youtube.com/watch?v=tyAutnOlsfA) evrything went good until i begun coding, i believed i filled out the exact same as he did, but i got an error saying: NullReferenceException: object not set to an intance of an object Player.fixedupdate () (atassets/player.cs:19) line 19 is the rb.MovePosition(rb.position + Vector2.right * x); using UnityEngine; using System.Collections; public class Player : MonoBehaviour { public float speed = 15f; private Rigidbody2D rb; void start () { rb = GetComponent(); } void FixedUpdate () { float x = Input.GetAxis("Horizontal") * Time.fixedDeltaTime * speed; rb.MovePosition(rb.position + Vector2.right * x); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



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