Input system

 avatar
unknown
csharp
a year ago
796 B
26
Indexable
using UnityEngine;
using UnityEngine.InputSystem;

public class InputManager : MonoBehaviour
{
    public InputMap Input {get; private set;}
    
    public static InputManager Instance { get; private set; }
    
    private void Awake()
    {
        if (Instance != null)
        {
            Debug.LogWarning("There is more than one instance of InputManager");
            return;
        }
        Instance = this;
    }

    //Subscribe to the input system
    private void OnEnable()
    {
        Input = new InputMap();

        Input.PlayerInput.Enable(); //Enable the player input actions

    }

    //Subscribe to the input system
    private void OnDisable()
    {

        Input.PlayerInput.Disable(); //Enable the player input actions
    }

}
Editor is loading...
Leave a Comment