disconnect navigation to DialogueSystem buttons

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

disconnect navigation to DialogueSystem buttons

Post by fkkcloud »

Hi,

during the conversation, I pop up a new UI with 3 buttons.

In order to let the event focus to be only on this pop up, I do below.

Code: Select all

PixelCrushers.UIPanel.monitorSelection = false;
eventSystemModule.GetComponent<EventSystem>().SetSelectedGameObject(null);
eventSystemModule.GetComponent<EventSystem>().SetSelectedGameObject(firstButtonGameObjectInPopUP);
Its good that the dialoguesystem don't get visible input yet but as I go down the list of 3 buttons then on 4th input, it selects the DialogueSystem's response Menu button (since I initiated pop up during response menu)

Is there any way to safely toggle the DialogueSystem's button/UI during conversation without changing its state too much so I can easily resume to conversation as this pop up UI goes away?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: disconnect navigation to DialogueSystem buttons

Post by Tony Li »

You must set your 3 buttons' Navigation so the user can't navigate away from them.
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: disconnect navigation to DialogueSystem buttons

Post by fkkcloud »

They are dynamically instantiated on runtime
fkkcloud
Posts: 298
Joined: Mon Oct 05, 2020 6:00 am

Re: disconnect navigation to DialogueSystem buttons

Post by fkkcloud »

I just manually set the navigations I think this'd do the job

Code: Select all

public void SortNavigation()
    {
        for (int i = 0; i < buttons.Length; i++)
        {
            AssignNavigation(i, buttons[i].button);
        }
    }

    private void AssignNavigation(int i, Button button)
    {
        Navigation nav = button.navigation;
        nav.mode = Navigation.Mode.Explicit;
        
        int upID = i - 1;
        if (upID > -1)
        {
            nav.selectOnUp = buttons[upID].button;
        }

        int downID = i + 1;
        if (downID < buttons.Length)
        {
            nav.selectOnDown = buttons[downID].button;
        }

        button.navigation = nav;
    }
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: disconnect navigation to DialogueSystem buttons

Post by Tony Li »

Hi,

Yes, that's correct. That's what the Dialogue System does, too, when it instantiates response buttons into the response menu.
Post Reply