I was following a tutorial on how to make a platformer (I'm new) and couldn't figure out why it gives me Null Reference Exception whenever I run the project, any help would be appreciated.
thank you!
The code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class movement : MonoBehaviour
{
public float speed;
public float jumpForce;
private float moveInput;
private Rigidbody2D rb;
void start()
{
rb = GetComponent<Rigidbody2D>();
}
void FixedUpdate()
{
moveInput = Input.GetAxisRaw("Horizontal");
rb.velocity = new Vector2(moveInput * speed, rb.velocity.y);
}
}
full error message: NullRefrenceException: Object reference not set to an instance of an object movement.FixedUpdate () (at Assets/movement.cs:21)