Quantcast
Viewing all articles
Browse latest Browse all 2891

I keep getting the error "NullReferenceException: Object reference not set to an instance of an object PlayerMovement.FixedUpdate () (at Assets/Scripts/PlayerMovement.cs:18)"

I do not know what I'm doing wrong. I've followed the instructions in the 2nd tutorial of unity and i'm trying to learn the basics in using it. If anyone could help me identify the error it will be deeply appreciated. It tells me that line 18 is not working. I know that its not reading the object correctly, but I can't identify the problem or how to solve it. I'm still learning the basics in unity. " using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { private Rigidbody rb; void start () { rb = GetComponent (); } void FixedUpdate () { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical"); Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical); rb.AddForce (movement); } }"

Viewing all articles
Browse latest Browse all 2891

Trending Articles