#1 - No warnings at all - and everything appears working correctly other than the HUD updating:
https://ibb.co/5rQTnht
I haven't assigned the HUD to the Player's Quest Journal component, so it should be using the default one as normal.
Here's the code for my custom condition (though I'm having the same issue with a 2nd custom condition that also appears to be working fine with no warnings or errors):
Code: Select all
namespace PixelCrushers.QuestMachine
{
public class HasRecipe : QuestCondition // Rename this class.
{
public StringField recipeName = new StringField();
public override void StartChecking(System.Action trueAction)
{
base.StartChecking(trueAction);
if (IsTrue())
{
SetTrue();
}
else
{
EventHandler.PlayerRecipeAdded += PlayerRecipeAdded;
}
}
private bool IsTrue()
{
foreach (var recipe in Statics.player.GetComponent<CharacterCraftingData>().playerRecipes)
{
if (recipe.name == recipeName.text)
{
return true;
}
}
return false;
}
private void PlayerRecipeAdded(string recipe)
{
recipeName.text = recipe;
if (IsTrue())
{
SetTrue();
}
}
public override void StopChecking()
{
base.StopChecking();
EventHandler.PlayerRecipeAdded -= PlayerRecipeAdded;
}
}
}
#2 - Here is the console output:
Quest Machine: Unable to restore quest: Ysabella - A Mirror to the Heart(Clone). Message: Object reference not set to an instance of an object
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
PixelCrushers.QuestMachine.QuestListContainer:ApplyData (string) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:461)
PixelCrushers.QuestMachine.QuestJournal:ApplyData (string) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestJournal.cs:208)
PixelCrushers.SaveSystem:ApplySavedGameData (PixelCrushers.SavedGameData) (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:654)
PixelCrushers.SaveSystem/<LoadSceneCoroutine>d__107:MoveNext () (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:765)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)
This happens after running my second custom function on the "Research Alchemic Extraction" node in the quest (code below) and after saving and loading. I'm not touching the quest asset at all between save and load.
Code: Select all
namespace PixelCrushers.QuestMachine
{
public class LearnedTech : QuestCondition // Rename this class.
{
public StringField techName = new StringField();
public override void StartChecking(System.Action trueAction)
{
base.StartChecking(trueAction);
if (IsTrue())
{
SetTrue();
}
else
{
EventHandler.LearnedTechnology += LearnedTechnology;
}
}
private bool IsTrue()
{
TechDatabase techDatabase = Statics.techDatabase;
foreach (var techCategory in techDatabase.techCategories)
{
foreach (var techGroup in techCategory)
{
foreach (var technology in techGroup)
{
if (technology.techName == techName.text)
{
if (technology.availabilityState == Technology.AvailabilityState.Learned)
{
return true;
}
}
}
}
}
return false;
}
private void LearnedTechnology(string tech)
{
Debug.Log(tech);
techName.text = tech;
if (IsTrue())
{
SetTrue();
}
}
public override void StopChecking()
{
base.StopChecking();
EventHandler.LearnedTechnology -= LearnedTechnology;
}
}
}
One other thing I noticed with the Quest Machine Debugger on is when I load my game, I get a lot of warnings that I don't get otherwise (maybe this is normal?):
https://ibb.co/GdHTvCm