Page 2 of 2

Re: Switching action map disables interaction

Posted: Fri Feb 07, 2025 4:13 pm
by DenisOwl
I found out exactly what stops working if you use PlayerInputWrapper.PlayerInput.SwitchCurrentActionMap("UI");

Unfortunately, I was not given permission to send the project files.

DialogueUI stops working if this code is triggered. Regardless of whether the dialogues were turned on before or not.
And when using Custom InputActionAsset in EventSystem

Code: Select all

    
    private IEnumerator SwitchInputAction(GameObject gameObject)
    {
        yield return new WaitForSecondsRealtime(0.1f);

        if (gameObject)
        {
            PlayerInputWrapper.PlayerInput.SwitchCurrentActionMap("UI");
        }
        else
        {
            PlayerInputWrapper.PlayerInput.SwitchCurrentActionMap("Player");
        }

        PlayerInputWrapper.PlayerInput.ActivateInput();
    }

Re: Switching action map disables interaction

Posted: Fri Feb 07, 2025 9:05 pm
by Tony Li
Hi,

Is the correct action map active while dialogue is active?

Re: Switching action map disables interaction

Posted: Wed Feb 12, 2025 12:57 pm
by DenisOwl
Solution:
add this script to Response Button Template in template

Code: Select all

using UnityEngine;

public class UISchemeChanger : MonoBehaviour
{
    private void OnEnable()
    {
        (GameCanvasInstance.Instance as GameCanvas).SetCurrent(gameObject);
    }

    private void OnDisable()
    {
        (GameCanvasInstance.Instance as GameCanvas).SetCurrent(null);
    }
}

Re: Switching action map disables interaction

Posted: Wed Feb 12, 2025 1:26 pm
by Tony Li
Thanks for sharing. It looks like maybe you're using UI Toolkit or NGUI or something because of the UIButton component.