Page 1 of 1
TimedCallbackManager console error
Posted: Thu Jul 28, 2022 9:20 pm
by cptscrimshaw
Hi Tony,
I've had this error when exiting playmode for ages but never did anything about it because it didn't seem to be affecting anything. Trying to tidy up remaining bugs, and thought you might be able to help out.
Code: Select all
Some objects were not cleaned up when closing the scene. (Did you spawn new GameObjects from OnDestroy?)
The following scene GameObjects were found:
TimedCallbackManager
It appears that the only TimedCallbackManager in my game is in the PixelCrushers namespace, so hoping you might be able to offer some insight.
Thanks!
Re: TimedCallbackManager console error
Posted: Thu Jul 28, 2022 9:33 pm
by Tony Li
Hi,
What version of the Dialogue System are you using?
What is the TimedCallbackManager script? I'm pretty sure it's not a Dialogue System thing, but maybe it came from some example scene that I don't remember.
Re: TimedCallbackManager console error
Posted: Fri Jul 29, 2022 12:50 am
by cptscrimshaw
Apologies! I should have posted this in the QuestMachine forum now that I looked where the file came from:
https://ibb.co/1Jg5wdg
Quest Machine is up-to-date except for the one you released most recently, I believe.
Here is the script:
Code: Select all
// Copyright © Pixel Crushers. All rights reserved.
using UnityEngine;
using System.Collections.Generic;
namespace PixelCrushers
{
/// <summary>
/// Invokes callback methods on timed frequencies.
/// </summary>
public class TimedCallbackManager : MonoBehaviour
{
private static TimedCallbackManager m_instance;
private static TimedCallbackManager instance
{
get
{
if (m_instance == null)
{
m_instance = new GameObject("TimedCallbackManager").AddComponent<TimedCallbackManager>();
DontDestroyOnLoad(m_instance.gameObject);
}
return m_instance;
}
}
public class CallbackInfo
{
public System.Action callback;
public float frequency;
public float remaining;
public CallbackInfo(System.Action callback, float frequency)
{
this.callback = callback;
this.frequency = frequency;
this.remaining = frequency;
}
public void Update()
{
remaining -= Time.deltaTime;
if (remaining < 0)
{
remaining = frequency;
callback();
}
}
}
private List<CallbackInfo> callbacks = new List<CallbackInfo>();
private void Update()
{
for (int i = 0; i < callbacks.Count; i++)
{
callbacks[i].Update();
}
}
public static void StartCallback(System.Action callback, float frequency)
{
instance.callbacks.Add(new CallbackInfo(callback, frequency));
}
public static void StopCallback(System.Action callback)
{
instance.callbacks.RemoveAll(x => x.callback == callback);
}
public static void StopAllCallbacks()
{
instance.callbacks.Clear();
}
}
}
Re: TimedCallbackManager console error
Posted: Fri Jul 29, 2022 9:25 am
by Tony Li
Hi,
Please try this patch, which should get rid of that (harmless) editor error:
[See below]
Re: TimedCallbackManager console error
Posted: Fri Jul 29, 2022 11:32 am
by cptscrimshaw
Getting a slew of errors after this patch (just two of them, but they show up several times).
https://ibb.co/qBpVr3d
Code: Select all
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.TimedCallbackManager.StartCallback (System.Action callback, System.Single frequency) (at Assets/Plugins/Pixel Crushers/Quest Machine/Third Party Support/Dialogue System Support/Scripts/Quest Conditions/TimedCallbackManager.cs:73)
PixelCrushers.QuestMachine.DialogueSystemSupport.LuaQuestCondition.StartChecking (System.Action trueAction) (at Assets/Plugins/Pixel Crushers/Quest Machine/Third Party Support/Dialogue System Support/Scripts/Quest Conditions/LuaQuestCondition.cs:44)
PixelCrushers.QuestMachine.QuestConditionSet.StartChecking (System.Action trueAction) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest Condition Set/QuestConditionSet.cs:128)
PixelCrushers.QuestMachine.Quest.SetStartChecking (System.Boolean enable) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest.cs:777)
PixelCrushers.QuestMachine.Quest.SetState (PixelCrushers.QuestMachine.QuestState newState, System.Boolean informListeners) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest.cs:869)
PixelCrushers.QuestMachine.Quest.RuntimeStartup () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest.cs:760)
PixelCrushers.QuestMachine.QuestListContainer.AddQuest (PixelCrushers.QuestMachine.Quest quest, System.Boolean delayStartup) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:237)
PixelCrushers.QuestMachine.QuestListContainer.AddQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:208)
PixelCrushers.QuestMachine.QuestGiver.AddQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:318)
PixelCrushers.QuestMachine.QuestListContainer.AddQuests (System.Collections.Generic.List`1[T] listToAdd) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:198)
PixelCrushers.QuestMachine.QuestListContainer.InstantiateQuestAssets () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:165)
PixelCrushers.QuestMachine.QuestListContainer.Awake () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:149)
PixelCrushers.QuestMachine.QuestGiver.Awake () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:186)
Code: Select all
NullReferenceException: Object reference not set to an instance of an object
PixelCrushers.TimedCallbackManager.StopCallback (System.Action callback) (at Assets/Plugins/Pixel Crushers/Quest Machine/Third Party Support/Dialogue System Support/Scripts/Quest Conditions/TimedCallbackManager.cs:78)
PixelCrushers.QuestMachine.DialogueSystemSupport.LuaQuestCondition.StopChecking () (at Assets/Plugins/Pixel Crushers/Quest Machine/Third Party Support/Dialogue System Support/Scripts/Quest Conditions/LuaQuestCondition.cs:51)
PixelCrushers.QuestMachine.QuestConditionSet.StopChecking () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest Condition Set/QuestConditionSet.cs:142)
PixelCrushers.QuestMachine.Quest.SetStartChecking (System.Boolean enable) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest.cs:788)
PixelCrushers.QuestMachine.Quest.SetState (PixelCrushers.QuestMachine.QuestState newState, System.Boolean informListeners) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest.cs:869)
PixelCrushers.QuestMachine.Quest.DestroyInstance (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest/Quest.cs:640)
PixelCrushers.QuestMachine.QuestListContainer.DeleteQuest (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:306)
PixelCrushers.QuestMachine.QuestListContainer.DestroyQuestInstances () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:173)
PixelCrushers.QuestMachine.QuestListContainer.OnDestroy () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestListContainer.cs:154)
PixelCrushers.QuestMachine.QuestGiver.OnDestroy () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest MonoBehaviours/Quest List/QuestGiver.cs:232)
Re: TimedCallbackManager console error
Posted: Fri Jul 29, 2022 2:34 pm
by Tony Li
Re: TimedCallbackManager console error
Posted: Fri Jul 29, 2022 5:05 pm
by cptscrimshaw
Beautiful, that worked! Thanks so much.
Re: TimedCallbackManager console error
Posted: Fri Jul 29, 2022 6:54 pm
by Tony Li
Glad to help!