Displaying quest log
-
- Posts: 30
- Joined: Sat Jan 19, 2019 2:14 pm
Displaying quest log
I'd like to display the quest log when a quest description in the quest HUD is clicked. Basically the same as what happens when you press the Quest Log hotkey. I've attached the Open() method of the quest log to a button I placed on the HUD' quest description, but this gives: Setting the parent of a transform which resides in a prefab is disabled to prevent data corruption.
Re: Displaying quest log
Hi,
Here's an example: DS_ClickQuestHUDExample_2019-01-27.unitypackage
I put the quest tracker HUD and quest log window in the scene as children of the Dialogue Manager's Canvas, and I removed the prefabs from the Dialogue Manager's Instantiate Prefabs component. This is the key. This way you can hook up behavior in the inspector.
The Quest Track Template has a UI Button that uses the script below when clicked. It assumes that you've set the quest tracker's Quest Description Source to Title, since it uses this to know what quest to open the window on.
OpenQuestLogOnHUDEntry.cs
Here's an example: DS_ClickQuestHUDExample_2019-01-27.unitypackage
I put the quest tracker HUD and quest log window in the scene as children of the Dialogue Manager's Canvas, and I removed the prefabs from the Dialogue Manager's Instantiate Prefabs component. This is the key. This way you can hook up behavior in the inspector.
The Quest Track Template has a UI Button that uses the script below when clicked. It assumes that you've set the quest tracker's Quest Description Source to Title, since it uses this to know what quest to open the window on.
OpenQuestLogOnHUDEntry.cs
Code: Select all
using PixelCrushers.DialogueSystem;
using UnityEngine;
public class OpenQuestLogOnHUDEntry : MonoBehaviour
{
public void OnClickEntry()
{
var questLogWindow = FindObjectOfType<QuestLogWindow>();
questLogWindow.Open();
questLogWindow.ClickQuest(GetComponent<StandardUIQuestTrackTemplate>().description.text);
}
}
-
- Posts: 30
- Joined: Sat Jan 19, 2019 2:14 pm
Re: Displaying quest log
That works! Fantastic.