Basically I have a Quest Giver Manager, that gives the player a quest manually via code. It only has the Quest Giver component, and my custom Quest Giver Manager script something like this:
Code: Select all
using PixelCrushers.QuestMachine;
using Sirenix.OdinInspector;
using UnityEngine;
public class QuestGiverManager : MonoBehaviour
{
private QuestGiver _questGiver;
[SerializeField] private string _questerIdToGive = "Player";
[SerializeField] private Quest _questToAdd;
[Button]
private void GiveQuest()
{
_questGiver = GetComponent<QuestGiver>();
_questGiver.GiveQuestToQuester(_questToAdd, _questerIdToGive);
}
}
But, when I stop and play the game again, the quest is automatically deleted from the QuestGiver's quest list. I found out that this is because the timesAccepted of the Quest is saved in the system and it will only work again if increase the "Max Times" of the quest to a high amount, OR I reset the timesAccepted of the quest manually like this:
Code: Select all
private void OnEnable()
{
_questToAdd.timesAccepted = 0;
}