Hey guys, I am new to working with Unity and code. I am trying to continue the “Roll a Ball” tutorial working on the first part of scripts in video 2: “Moving the Player”. After completely the script for adding force and direction to to the ‘rigid body’, "I attempt to play test the movement and it does not move at all. At the bottom of the screen it also states “NullReferenceException: Object reference not set to an instance of an object”. This is painfully hard to find a solution for as I cannot find it anywhere else on the forums, youtube comments, etc. Please help and thanks!!!
Here is my script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour {
private Rigidbody rb;
void start ()
{
rb = GetComponent<Rigidbody>();
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement);
}
}