public void SetInputUser(InputUser inputUser, InputDevice controller) { m_CurrentController = (Gamepad)controller; m_Controls = (Controls)inputUser.actions; InputSystemUIInputModule inputModule = transform.parent.parent.GetComponentInChildren <InputSystemUIInputModule>(); m_CharacterControl = GetComponentInChildren <CharacterControl>(); foreach (InputAction action in inputUser.actions) { PlayerInput.ActionEvent newEvent = new PlayerInput.ActionEvent(action); /* ADD one of these to the case to invoke the action * action.performed += newEvent.Invoke; * action.canceled += newEvent.Invoke; * action.started += newEvent.Invoke; */ switch (action.name) { case "Selection": if (inputModule != null) { InputActionReference selectionRef = ScriptableObject.CreateInstance <InputActionReference>(); selectionRef.Set(action); inputModule.move = selectionRef; } break; case "Select": action.performed += newEvent.Invoke; if (inputModule != null) { InputActionReference selectRef = ScriptableObject.CreateInstance <InputActionReference>(); selectRef.Set(action); inputModule.submit = selectRef; } break; case "Start": break; case "Rotate": newEvent.AddListener(Rotate); action.started += newEvent.Invoke; action.performed += newEvent.Invoke; action.canceled += newEvent.Invoke; break; case "Movement": newEvent.AddListener(m_CharacterControl.Movement); action.started += newEvent.Invoke; action.performed += newEvent.Invoke; action.canceled += newEvent.Invoke; break; case "Jump": m_SkipEvents.Add(newEvent); newEvent.AddListener(m_CharacterControl.Jump); action.performed += newEvent.Invoke; break; case "Push": newEvent.AddListener(m_CharacterControl.Push); action.performed += newEvent.Invoke; break; case "Interact": newEvent.AddListener(m_CharacterControl.Interact); action.performed += newEvent.Invoke; break; default: Debug.Log("There is no functionality yet for action: " + action.name + " in action map: " + action.actionMap); break; } } }