Page 2 of 2
Re: Question for my mobile game project 1
Posted: Thu Apr 20, 2017 9:26 am
by Tony Li
Hi,
Thanks for posting the screenshot. It was very helpful.
For #1, assign the button's OnClick() event to the quest log window's Open() method (UnityUIQuestLogWindow.Open).
For #2, make sure your achievements panel has a SelectablePanel component. Then assign the button's OnClick() event to SelectablePanel.Open.
For #3, assign the button's OnClick() event to the Pause panel's SelectablePanel.Open.
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 9:14 am
by davidsibya08
Thank you very much sir.
I got it already. Additional question, how would I set the HUD to be visible when it is in the gameplay?
Is there a documentation for SelectablePanel component?
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 9:29 am
by Tony Li
If your HUD has a unique GameObject name (for example, "HUD"), you could add a script like this to all gameplay scenes:
ShowHUD.cs
Code: Select all
using UnityEngine;
using PixelCrushers.DialogueSystem;
public class ShowHUD : MonoBehaviour {
void Start() {
Tools.GameObjectHardFind("HUD").SetActive(true);
}
void OnDestroy() {
Tools.GameObjectHardFind("HUD").SetActive(false);
}
}
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 9:46 am
by davidsibya08
Is there a way that I could just set that up into the UI?
Sir, is there a documentation for Selectable Object UI?
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 10:03 am
by Tony Li
Hi,
davidsibya08 wrote:Is there a way that I could just set that up into the UI?
No. I assume the UI is set to persist during scene changes. (In other words, the UI exists in the main menu scene, and when you change to the gameplay scene the UI is still there.) In this case, how will the UI know when to show or hide the HUD? There are always other ways, of course, but I think the script above is the easiest.
davidsibya08 wrote:Sir, is there a documentation for Selectable Object UI?
When do you mean by that? If you mean the Selector and Proximity Selector, then it's on
this page.
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 10:22 am
by davidsibya08
Ahh I get it. I will try it first.
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 10:29 am
by davidsibya08
There is a problem with the pause button, I can already see the HUD during game play.
When I clicked the Pause Button, it shows the Pause panel but when I clicked the Pause Button again it only shows the Options Tint and then I have to press escape to see the Pause Panel.
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 10:42 am
by Tony Li
It's just a matter of working through the logic of opening and closing the UI panels. There are a few ways you could do it. Here's one way:
1. Add another entry to the HUD button's OnClick() event. Use this entry to deactivate the HUD GameObject. (Assign HUD, and select GameObject.SetActive.)
2. Inspect the PausePanel. Add an entry to the OnOpen() event. Use this entry to reactivate the HUD GameObject.
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 1:08 pm
by davidsibya08
Haha. Finally! Thank you sir.
I'm so glad you're just out there for help.
Thank you sir Tony.
Re: Question for my mobile game project 1
Posted: Sun Apr 23, 2017 1:50 pm
by Tony Li
Glad to help!