here the code:
Code: Select all
public override void ShowResponses (Subtitle subtitle, Response[] responses, float timeout) {
base.ShowResponses(subtitle, responses, timeout);
SetButtonsNav();
if (autoFocus) dialogue.responseMenu.AutoFocus();
}
void SetButtonsNav()
{
List<GameObject> buttons = dialogue.responseMenu.instantiatedButtons;
Debug.Log (buttons.Count);
int totals = buttons.Count;
for(int i = 0; i < totals; i++)
{
Navigation current = buttons[i].GetComponent<Button>().navigation;
current.selectOnUp = (i == 0)? buttons[totals-1].GetComponent<Button>(): buttons[i-1].GetComponent<Button>();
current.selectOnDown = (i == totals)? buttons[0].GetComponent<Button>(): buttons[i+1].GetComponent<Button>();
}
}
the main idea is setup the nav of the response buttons like doc recomend becouse the automatic one is little crazy and in the game when i talk with a NPC who has various responses show me the corrects number of buttons but the dialogue.responseMenu.instantiatedButtons give a value of 0 buttons and dont enter in the loop
and other rare thing is the showResponse is called twice (the same number of buttons of the npc im using to) this is normal?
im using the new unity ui and the canvas is on world space
Thank you so much for the help