'I was watching a tutorial on unity but I came across these errors [duplicate]

everything is in unity

the errors

code 1

code 2

If anyone can help me I am new

This is the code for PlayerInput:

https://pastebin.com/hWNPVmZJ



Solution 1:[1]

NullRefereenceException usually refer that there's a variable/field is not set/ initialized during my intial review of your code there is playerVelocity field in PlayerMotor which is not initilized in the start or awake methods and its a private field so i also assumed that you didnt set value for it from inspector too

so in processMove method you are trying to access to playerVelocity which has a null as value

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 SomebodyAwful