Page 1 of 2

Main Menu & Quest Machine

Posted: Sun Aug 25, 2019 6:31 am
by Mchia_Soo
Hey Tony!

I have a doubt regarding the Main Menu and Quest Machine. I built another scene for my main menu and at the same time, I create an Option button in the game which contains Quest Machine and Dialogue System.

Everything works fine except when I press on the Option button to return back to main menu. The Option panel that I created do not disappear, as well as all the buttons & HUD text in the game.

The steps that I have tried to solve this issue:
1. Set inactive to all the buttons. But I found out that when I click Play to restart the game, the game is actually in paused mode (not end).

2. Set the Time.timeScale to 1 in my main menu scene. However, it didn't help to fix it.

3. Create another canvas and put all the buttons into it. This deactivates all the buttons and could not be clicked at all.

4. Create another scene for Pause Menu - same problems are still there and Resume button become Restart.

Also, if I manage to resume the game, there's no response after clicking on the buttons.

Is this actually related to any option in Quest Machine or Dialogue System? Hope you can provide me some advice/suggestions to resolve it. Have been solving it for few weeks.

Re: Main Menu & Quest Machine

Posted: Sun Aug 25, 2019 9:04 am
by Tony Li
Hi,

The Quest Machine GameObject and the Dialogue Manager GameObject both survive scene changes. Can you put them on their own GameObjects instead of Options?

Re: Main Menu & Quest Machine

Posted: Sun Aug 25, 2019 9:45 am
by Mchia_Soo
Sorry, I don't get what you meant.

Re: Main Menu & Quest Machine

Posted: Sun Aug 25, 2019 3:33 pm
by Tony Li
Maybe I misunderstood.

Do you want to hide the Dialogue System and Quest Machine UIs when you return to the title menu scene?

If so:
  • Dialogue System: Deactivate the Canvas GameObject. When returning to a gameplay scene, reactivate it.
  • Quest Machine: Deactivate the Quest Machine Canvas GameObject. When returning to a gameplay scene, reactivate it.

Re: Main Menu & Quest Machine

Posted: Sun Aug 25, 2019 8:45 pm
by Mchia_Soo
Is there any coding or button that can deactivate and reactivate it back?

Re: Main Menu & Quest Machine

Posted: Sun Aug 25, 2019 9:00 pm
by Tony Li
Yes. In code:

Code: Select all

DialogueManager.instance.GetComponentInChildren<Canvas>().enabled = ...
QuestMachineConfiguration.instance.GetComponentInChildren<Canvas>().enabled = ...
where ... is true or false depending on whether you want to show or hide the UIs.

Re: Main Menu & Quest Machine

Posted: Sun Aug 25, 2019 10:55 pm
by Mchia_Soo
Tony Li wrote: Sun Aug 25, 2019 9:00 pm Yes. In code:

Code: Select all

DialogueManager.instance.GetComponentInChildren<Canvas>().enabled = ...
QuestMachineConfiguration.instance.GetComponentInChildren<Canvas>().enabled = ...
where ... is true or false depending on whether you want to show or hide the UIs.
What you meant is to add these two line codes in my coding right? I have checked these scripts and both of them are using namespace. How to add them into my script as the red lines appear below the DialogueManager and the QuestMachineConfiguration?

Sorry, I am not familiar with the namespace.

//Update: Manage to solve the error - add the 'using PixelCrushers.QuestMachine;' will do.
Just wondering why do my buttons deactivate after restarting the game, but the HUD and alert texts work fine?

Re: Main Menu & Quest Machine

Posted: Mon Aug 26, 2019 8:46 am
by Tony Li
Mchia_Soo wrote: Sun Aug 25, 2019 10:55 pmJust wondering why do my buttons deactivate after restarting the game, but the HUD and alert texts work fine?
If I understand you correctly, this is because the Dialogue Manager and Quest Machine GameObjects survive scene changes, so they are present and ready to display content when needed after restarting the game.

Re: Main Menu & Quest Machine

Posted: Mon Aug 26, 2019 8:54 am
by Mchia_Soo
Can you explain more about the survive scene? And how can I solve this issue?

Re: Main Menu & Quest Machine

Posted: Mon Aug 26, 2019 9:32 am
by Tony Li
Can you describe the problem again please? If possible, please add some screenshots that show the issue.