0
Planned

Quests broke GC Preferences

Yojimbo 2 weeks ago in Quests updated 2 weeks ago 2

I'm running into an error related to the Quests module. I added a new quest with some tasks. Now the GC Preferences window paint is broken.

Here are the error descriptions:

ArgumentException: An item with the same key has already been added. Key: 24746
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at :0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at :0)
GameCreator.Quests.QuestsTreeView.BuildTree (UnityEditor.IMGUI.Controls.TreeViewItem& parentTree, GameCreator.Quests.IQuest parentAsset) (at Assets/Plugins/GameCreator/Quests/Editor/Database/QuestsTreeView.cs:47)
GameCreator.Quests.QuestsTreeView.BuildTree (UnityEditor.IMGUI.Controls.TreeViewItem& parentTree, GameCreator.Quests.IQuest parentAsset) (at Assets/Plugins/GameCreator/Quests/Editor/Database/QuestsTreeView.cs:69)
GameCreator.Quests.QuestsTreeView.BuildTree (UnityEditor.IMGUI.Controls.TreeViewItem& parentTree, GameCreator.Quests.IQuest parentAsset) (at Assets/Plugins/GameCreator/Quests/Editor/Database/QuestsTreeView.cs:69)
GameCreator.Quests.QuestsTreeView.BuildTree (UnityEditor.IMGUI.Controls.TreeViewItem& parentTree, GameCreator.Quests.IQuest parentAsset) (at Assets/Plugins/GameCreator/Quests/Editor/Database/QuestsTreeView.cs:69)
GameCreator.Quests.QuestsTreeView.BuildRoot () (at Assets/Plugins/GameCreator/Quests/Editor/Database/QuestsTreeView.cs:79)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.FetchData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeViewDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewDataSource.cs:53)
UnityEditor.IMGUI.Controls.TreeView+TreeViewControlDataSource.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControlDataSource.cs:25)
UnityEditor.IMGUI.Controls.TreeViewController.ReloadData () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewController.cs:289)
UnityEditor.IMGUI.Controls.TreeView.Reload () (at C:/buildslave/unity/build/Editor/Mono/GUI/TreeView/TreeViewControl/TreeViewControl.cs:105)
GameCreator.Quests.QuestsTreeView..ctor (UnityEditor.IMGUI.Controls.TreeViewState state, GameCreator.Quests.DatabaseQuestsEditor questsEditor) (at Assets/Plugins/GameCreator/Quests/Editor/Database/QuestsTreeView.cs:42)
GameCreator.Quests.DatabaseQuestsEditor.OnEnable () (at Assets/Plugins/GameCreator/Quests/Editor/Database/DatabaseQuestsEditor.cs:91)
UnityEditor.Editor:CreateEditor(Object)
GameCreator.Core.DatabaseInfo:.ctor(IDatabase) (at Assets/Plugins/GameCreator/Core/Editor/Preferences/PreferencesWindow.cs:32)
GameCreator.Core.PreferencesWindow:LoadDatabases() (at Assets/Plugins/GameCreator/Core/Editor/Preferences/PreferencesWindow.cs:147)
GameCreator.Core.PreferencesWindow:OpenWindow() (at Assets/Plugins/GameCreator/Core/Editor/Preferences/PreferencesWindow.cs:223)

And...

NullReferenceException: Object reference not set to an instance of an object
GameCreator.Quests.DatabaseQuestsEditor.PaintQuestToolbar () (at Assets/Plugins/GameCreator/Quests/Editor/Database/DatabaseQuestsEditor.cs:270)
GameCreator.Quests.DatabaseQuestsEditor.OnInspectorGUI () (at Assets/Plugins/GameCreator/Quests/Editor/Database/DatabaseQuestsEditor.cs:261)
GameCreator.Core.IDatabaseEditor.OnPreferencesWindowGUI () (at Assets/Plugins/GameCreator/Core/Editor/Data/IDatabaseEditor.cs:17)
GameCreator.Core.PreferencesWindow.PaintContent (System.Int32 currentSidebarIndex) (at Assets/Plugins/GameCreator/Core/Editor/Preferences/PreferencesWindow.cs:189)
GameCreator.Core.PreferencesWindow.OnGUI () (at Assets/Plugins/GameCreator/Core/Editor/Preferences/PreferencesWindow.cs:92)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:342)
UnityEditor.HostView.Invoke (System.String methodName) (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:336)
UnityEditor.HostView.OldOnGUI () (at C:/buildslave/unity/build/Editor/Mono/HostView.cs:129)
UnityEngine.Experimental.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout) (at C:/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:244)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Any idea how to fix it or get the GC Preferences to display again? Thanks!

Unity version:
2018.4.13f1
Game Creator version:
1.1.2
Planned

Hi Yojimbo;

Sorry about this. Unity's Undo (Ctrl + Z) system is quite complex and we might have missed a case. I'm opening a ticket to have this fixed as soon as possible.

As for the Quests, unfortunately it's very hard to recover the previous tasks without digging into the debug inspector and changing some very specific fields.

But if you don't mind losing the previous quests do as follows: From your Project Panel, navigate to the following file: Assets/Plugins/GameCreatorData/Quests/Resources/GameCreator/Databases/. You should see an object called "DatabaseQuests". Delete it and restart Unity.

It should now work fine. Sorry for the inconvenience though. We've been tracking and fixing all Undo procedures because they break Game Creator's architecture, but looks like this one slipped our tests.

I'm marking this topic as Planned and circle back once it's fixed.

Ok, thanks for the info.