currentSelectedGameObject is set to null when calling ShowAlert and/or HideAlert
Posted: Thu Jul 19, 2018 4:46 pm
Hello Tony,
I think I have a problem that looks like to be related to Dialogue System. Here is my case.
I have GameObject which implement OnTriggerEnter2D that is calling DialogueManager.ShowAlert(_ActivationAlertText, 99999f) and OnTriggerExit2D that is calling DialogueManager.DialogueUI.HideAlert() (by the way, why is ShowAlert() directly under DialogueManager while HideAlert() is under DialogueManager.DialogueUI?). This Alert message is displaying something like "Press 'A' to open the crafting station". When the user is pressing 'A' for the first time, I'm calling DialogueManager.DialogueUI.HideAlert() AND I'm displaying a custom UI (not going through DS UI). In that custom UI, I'm calling:
to set focus on and select my continue button. However, the EventSystem.current.currentSelectedGameObject does get reset to null. By investigating a little bit while looking at the debug info from the EventSystem, when an ShowAlert is called, it looks like DS is setting the currentSelectedGameObject to null since upon exiting the trigger zone (without entering the tutorial), my previous currentSelectedGameObject is set back.
So, my main problem now is that it seems like I can't set properly my selectedGameObject on my Continue button in my tutorial screen because DS is setting it back to null upon calling one of the Alert methods.
Any idea on how to fix this issue? Thanks!
I think I have a problem that looks like to be related to Dialogue System. Here is my case.
I have GameObject which implement OnTriggerEnter2D that is calling DialogueManager.ShowAlert(_ActivationAlertText, 99999f) and OnTriggerExit2D that is calling DialogueManager.DialogueUI.HideAlert() (by the way, why is ShowAlert() directly under DialogueManager while HideAlert() is under DialogueManager.DialogueUI?). This Alert message is displaying something like "Press 'A' to open the crafting station". When the user is pressing 'A' for the first time, I'm calling DialogueManager.DialogueUI.HideAlert() AND I'm displaying a custom UI (not going through DS UI). In that custom UI, I'm calling:
Code: Select all
EventSystem.current.SetSelectedGameObject(null);
yield return null;
_ContinueButton.Select();
_ContinueButton.OnSelect(null);
So, my main problem now is that it seems like I can't set properly my selectedGameObject on my Continue button in my tutorial screen because DS is setting it back to null upon calling one of the Alert methods.
Any idea on how to fix this issue? Thanks!