I’m new to unity and decided to start by going through the roll-a-ball video tutorial. I made this script to control the player through keyboard inputs:
using UnityEngine;
using System.Collections;
public class Player_Control : 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);
}
}
But when i run the game it stops after the first frame with no player movement, and brings up this error message - NullReferenceException: Object reference not set to an instance of an object
Player_Control.FixedUpdate () (at Assets/Scripts/Player_Control.cs:20)
Any help would be much appreciated
Jelleyzeefirst,