Hi guys i am really new to programming and unity and I keep getting this error, I was just trying to learn how to make my character load and this error comes up:
NullReferenceException: Object reference not set to an instance of an object
PlayerMovement.FixedUpdate () (at Assets/PlayerMovement.cs:26)
And this is my code:
public class PlayerMovement : MonoBehaviour
{
public CharacterController2D controller;
public float runSpeed = 40f;
float horizontalMove = 0f;
// Update is called once per frame
void Update()
{
horizontalMove = Input.GetAxisRaw(“Horizontal”) * runSpeed;
}
void FixedUpdate()
{
// Move Character
controller.Move(horizontalMove * Time.fixedDeltaTime, false, false);
}
}
Can you please help me please.