Page 1 of 1

How to Open and Close the Quest Log from Script

Posted: Mon Apr 10, 2023 9:31 pm
by DrewThomasArt
Hi,
I edited the Basic Prefab Quest Log Window from the Dialogue Manager prefabs, and I need to program buttons in my game's UI to open and close the Quest Window so the player can click through the UI's other windows.

I tried this because I read it on the Quests documentation, but it's not working,

Code: Select all

  public void OpenQuestsPage()
    {
        inventoryUI.Hide();
         contactsUI.Hide();
        DialogueManager.Open();
    }
Is there a method I can call to open and close it?
Thanks for any help!

Re: How to Open and Close the Quest Log from Script

Posted: Mon Apr 10, 2023 10:08 pm
by Tony Li
Hi,

Try this:

Code: Select all

var questLogWindow = FindObjectOfType<QuestLogWindow>();
if (questLogWindow.isOpen) questLogWindow.Close(); else questLogWindow.Open();
Also, I recommend duplicating the quest log window prefab and using the duplicate. This way you won't accidentally overwrite your customizations if you update to a newer version of the Dialogue System.

Re: How to Open and Close the Quest Log from Script

Posted: Mon Apr 10, 2023 10:40 pm
by DrewThomasArt
Tony Li wrote: Mon Apr 10, 2023 10:08 pm Hi,

Try this:

Code: Select all

var questLogWindow = FindObjectOfType<QuestLogWindow>();
if (questLogWindow.isOpen) questLogWindow.Close(); else questLogWindow.Open();
Also, I recommend duplicating the quest log window prefab and using the duplicate. This way you won't accidentally overwrite your customizations if you update to a newer version of the Dialogue System.
It's working great, thank you!!
And yes, I am doing that because I wanted to have a back up in case I messed up. Good to know that it will save me from updates as well though.

Re: How to Open and Close the Quest Log from Script

Posted: Mon Apr 10, 2023 10:46 pm
by Tony Li
Glad to help!