NullReferenceException: Object reference not set to an instance of an object Player.Update () (at Assets/Player.cs:109)

I wanted to code that the collision doesn´t collide the Player but whenever I try it the error comes
202136-ghost-run-samplescene-windows-mac-linux-unity-2021.png

that’s where the error comes from:

If I’m not mistaken, Physics2D.Raycast returns a RaycastHit2D and you’re checking for a bool value at the beginning of your IF statement Wallcheck == false. Does this not throw an error?

I think the NullReferenceException might appear because (A) there’s no collision happening and Wallcheck is null or (B) no RigidBody2D was set on the object with the script attached.

Try checking if Wallcheck != null before anything else.