Hi, i started Unity this morning in a 2D sample game, UFO Project ([Archived] 2D UFO - Unity Learn)
in the fird video, in the physics scripts , they told to me to write:
private Rigidbody2D rb2d;
void start()
{
rb2d = GetComponent ();
}
void FixedUpdate() {
float moveHorizontal = Input.GetAxis (“Horizontal”);
float moveVertical = Input.GetAxis (“Vertical”);
Vector2 movement = new Vector2 (moveHorizontal, moveVertical);
rb2d.AddForce (movement);
}
but, the console when i exe the game say :
NullReferenceException: Object reference not set to an instance of an object
PlayerControler.FixedUpdate () (at Assets/TutorialInfo/Scripts/PlayerControler.cs:16)
Please help me because, i don’t know why…