Hi, so I am having problem with a new input system. I have an Input manager singleton class that looks like this
public class InputManager : GenericSingletonClass<InputManager>
{
private Controlls _controls;
public Controlls.MovementActions MovementActions;
public Controlls.SwitchingActions SwitchingActions;
public override void Awake()
{
base.Awake();
_controls = new Controlls();
MovementActions = _controls.Movement;
SwitchingActions = _controls.Switching;
}
private void OnEnable()
{
MovementActions.Moving.Enable();
MovementActions.Action.Enable();
MovementActions.Jump.Enable();
MovementActions.CameraControll.Enable();
MovementActions.CameraActivation.Enable();
}
private void OnDisable()
{
MovementActions.Moving.Disable();
MovementActions.Action.Disable();
MovementActions.Jump.Disable();
MovementActions.CameraControll.Disable();
MovementActions.CameraActivation.Disable();
}
}
and I am using events from input actions like this
private void OnEnable()
{
InputManager.Instance.MovementActions.Action.performed += UseAction;
}
private void OnDisable()
{
InputManager.Instance.MovementActions.Action.performed -= UseAction;
}
and everything works correctly, untill I close and open the project back up. When I reopen the project and go into play mode I get exceptions for every input action in controlls.inputactions/ its generated script, like this
NullReferenceException: Object reference not set to an instance of an object
MazeGame.Inputs.Controlls+MovementActions.get_Action () (at Assets/_Scripts/Inputs/Controlls.cs:392)
MazeGame.Characters.Pickup.OnEnable () (at Assets/_Scripts/Character/Pickup.cs:23)
Any ideas what can be the problem?