How to Open and Close the Quest Log from Script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
DrewThomasArt
Posts: 60
Joined: Thu Mar 24, 2022 12:07 am

How to Open and Close the Quest Log from Script

Post 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!
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
DrewThomasArt
Posts: 60
Joined: Thu Mar 24, 2022 12:07 am

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

Post 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.
User avatar
Tony Li
Posts: 21684
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Glad to help!
Post Reply