Whenever I try to press the left arrow an error pops up.
It’s because the rb2d
you used in Update()
is null. You did not set it to anything
In your Start
method, you set a local variable to the component. You should be setting the class’ member variable
void Start()
{
rb2d = GetComponent<Rigidbody2D>();
}
1 Like
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.