I'm more or less beginninga beginner developer and I'm currently working on a 3D game project with a third person view. When
When I implemented my first ActionMapActionMap into my character controller, everything worked fine, PlayerControls. The PlayerControls object has been calledwas stored inside the class with input callbacks and it was enough for walking, sprinting, jumping, etc.
But when I created another ActionMapActionMap for actions (attack, gather, interact) and decided to move PlayerControlsPlayerControls implementation into another, centralized script, everything crumbled down.
Upon starting play mode in Unity, I get a Upon starting play mode in unity I get a NullRefrenceException in the OnEnable cycle in PlayerLocomotionInput. After adding some lines for debugging, I've figured out that Instance is null at the beginning of LocomotionInput OnEnable cycle, in addition, I don't see a DontDestroyOnLoad folder in the hierarchy during play mode.NullRefrenceException in the OnEnable method in PlayerLocomotionInput. After adding some lines for debugging, I've figured out that Instance is null when LocomotionInput.OnEnable() is called. In addition, I don't see a DontDestroyOnLoad folder in the hierarchy during play mode.
What I was trying to do, is to make a class InputManager, create a singleton to access objects of this class and create PlayerControls object that can be accessed elsewhere: