New Input System

DrewofDonuts

New member
Hello,

I searched the forum, but I couldn't find anything helpful to me. Are there any actual instructions on how to integrate the new Input System (no 3rd Party Controller) with UIS?

I am using Unity's PlayerInput component to invoke Unity Events in my scripts, in case that is relevant. Also, I have downloaded the integration pack (FYI - it's not available within the UIS Manager to download. Had to go to Opsive site).

Thank you!
 
Last edited:
We share the input integration between the character and the inventory asset.
The documentation for this input integration can be found in the character documentation:

Sorry for the confusion
 
I hate to ask for additional help...I followed those instructions, started to get things hooked up, but is there any additional documentation on all the items/controls to map?

Also, I didn't understand the existing documentation on how to block player movement while within the inventory screen - would it be too much to ask for some more explicit instructions? I'd greatly appreciate it.

Thank you for your help!
 
Last edited:
No need to be afraid to ask.

The inputs are defined in the Action map, and in code we check those inputs by name.

To block the player inputs when the menu is opened we use this option here:
1623951878201.png
This enables the player input whenever the "Gameplay Panel" is selected. Meaning whenever a Menu is selected we disable player input.

In code it looks like this:

Code:
if (eventData.ThisPanel == GameplayPanel) {
    EventHandler.ExecuteEvent<bool>(m_PanelOwner, EventNames.c_GameObject_OnGameplayPanelSelected_Bool, true);
    if (m_EnableInputOnGameplaySelected) {
        EventHandler.ExecuteEvent<bool>(m_PanelOwner, EventNames.c_CharacterGameObject_OnEnableGameplayInput_Bool, true);
    }
} else if (eventData.PreviousPanel == GameplayPanel) {
    EventHandler.ExecuteEvent<bool>(m_PanelOwner, EventNames.c_GameObject_OnGameplayPanelSelected_Bool, false);
    if (m_EnableInputOnGameplaySelected) {
        EventHandler.ExecuteEvent<bool>(m_PanelOwner, EventNames.c_CharacterGameObject_OnEnableGameplayInput_Bool, false);
    }
}

This will disable the Player Input component. Then each component that uses input will usually check if the component is disabled. If it is then we don't check input.
The exception being inputs that we also use in the UI. Those always don't check whether the component is disabled or not.

I hope that makes sense. Let me know if you need me to clarify something else
 
Thank you for the help! I'm unfortunately still struggling. Regardless of whether I have the Enable Input On Gameplay Selected field checked or not, movement is still passing through to my character while I have the inventory open. I'm not sure what I'm doing wrong, but assistance is appreciated.

Inventory Canvas Panel's component:
1623971561304.png

Player Input:

Passes a Vector2to my InputHandlerscript
1623971591912.png

Using Start/Select to Open and Close the Main Menu:

1623971790761.png
 
To clarify, are you using your own character with its own movement script?

If that's the case you need to check whether the input is disabled or not.
Like I mentioned in the previous post the root inputs aren't blocked by our system. each time you check an input through the Player Input component you must check whether it is enabled or not.

You can either enable and disable your component using the event:
Code:
protected void Awake()
{
    if(m_PlayerInput == null){ return; }
    EventHandler.RegisterEvent<bool>(m_PlayerInput.gameObject, EventNames.c_CharacterGameObject_OnEnableGameplayInput_Bool, HandleEnableGameplayInput);
}

private void HandleEnableGameplayInput(bool enable)
{
    enabled = enable;
}

private void Update()
{
    //Check input here.
}

private void OnDestroy()
{
    if(m_PlayerInput == null){ return; }
    EventHandler.UnregisterEvent<bool>(m_PlayerInput.gameObject, EventNames.c_CharacterGameObject_OnEnableGameplayInput_Bool, HandleEnableGameplayInput);
}

or you can simply check if the component is enabled/disabled:

Code:
private void Update()
{
    if (m_PlayerInput.isActiveAndEnabled == false) {
        return;
    }
    //Check input here.
}

You can either directly get the input from the New Input System Player Input component.
Or if you wish to use our input system which abstracts the input you can use the "SimpleInput" class

Code:
[Tooltip("Interaction Input.")]
[SerializeField] protected SimpleInput m_Input = new SimpleInput("Action", InputType.ButtonDown);

private void Update()
{
    if(m_PlayerInput == null || m_PlayerInput.isActiveAndEnabled  == false){ return; }
    if (m_Input.CheckInput(m_PlayerInput)) {
         //The input is true do something here.
    }
}

I hope that clarifies your misunderstandings
 
Thank you for the response - I suppose I hit somewhat of a limitation on my own part, so I do not know how to implement your solution. Instead, I am just doing a check within in my scripts to block player input whenever those UI elements (game objects) are active. Hopefully this doesn't bite me later on.

But if a video tutorial on this is ever created, I'll be all over it ?

Thank you again for the help and your patience!
 
Top