New Error when returning to scene

Announcements, support questions, and discussion for Quest Machine.
Post Reply
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

New Error when returning to scene

Post by nathanj »

Hi Tony,

Edit: Found the solution buy calling PixelCrushers.QuestMachine.QuestMachine.UnregisterAllQuestAssets();
when we leave scene.

Ill leave this below just incase it helps someone else.


I've just noticed this error occurring and am hoping you can see from the message where I should be looking.

Code: Select all

ArgumentException: An item with the same key has already been added. Key: FindTheRiver
System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <d7ac571ca2d04b2f981d0d886fa067cf>:0)
PixelCrushers.QuestMachine.QuestMachine.RegisterQuestAsset (PixelCrushers.QuestMachine.Quest quest) (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest Machine/QuestMachine.cs:211)
PixelCrushers.QuestMachine.QuestMachineConfiguration.RegisterQuestDatabases () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest Machine/QuestMachineConfiguration.cs:267)
PixelCrushers.QuestMachine.QuestMachineConfiguration.Awake () (at Assets/Plugins/Pixel Crushers/Quest Machine/Scripts/Quest Machine/QuestMachineConfiguration.cs:216)
We are using two scenes, one with USurvival and one without. The player moves between the two. The error only occurs when the player enters the USurvival scene the second time.

I should add that the Save System component is on a separate game object that is persistent but the DIalogue System Controller and all other manager scripts (as well as all USurvival managers) components are destroyed when in the other scene.


Or is this just simple a self inflicted error because USurvival is not really designed to be shut down? If this is the case we can find a simple workaround to reset the database every time we leave.

Sorry to bother you again,
Nathan
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: New Error when returning to scene

Post by Tony Li »

I'll check this, too. But you're correct that uSurvival wasn't really designed to be shut down. You can have as many scenes as you want before the uSurvival scene, but you need to do some cleanup if leaving the uSurvival scene.
Post Reply