Switching action map disables interaction

Announcements, support questions, and discussion for the Dialogue System.
DenisOwl
Posts: 5
Joined: Thu Feb 06, 2025 7:46 am

Re: Switching action map disables interaction

Post 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();
    }
Last edited by DenisOwl on Fri Feb 28, 2025 6:06 pm, edited 1 time in total.
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching action map disables interaction

Post by Tony Li »

Hi,

Is the correct action map active while dialogue is active?
DenisOwl
Posts: 5
Joined: Thu Feb 06, 2025 7:46 am

Re: Switching action map disables interaction

Post 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);
    }
}
Attachments
Снимок экрана 2025-02-12 204722.png
Снимок экрана 2025-02-12 204722.png (119.97 KiB) Viewed 892 times
User avatar
Tony Li
Posts: 22886
Joined: Thu Jul 18, 2013 1:27 pm

Re: Switching action map disables interaction

Post by Tony Li »

Thanks for sharing. It looks like maybe you're using UI Toolkit or NGUI or something because of the UIButton component.
Post Reply