i just started working in unity3d.
i have this class
using UnityEngine;
using System.Collections;
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);
}
}
it displays an error :
NullReferenceException: Object Reference not set to an instance of an object.
line : 11 {rb.AddForce(movement)}
please share if anyone knows what's the problem and how to solve it.