Page 1 of 1

Error Occurred When Loading Game Using Save System

Posted: Fri Feb 21, 2025 7:44 am
by illusorys
I followed the video tutorial to configure the Save System provided by the Dialogue System. However, an error occurred the moment I clicked the load button(loadfromslot) after saving the game:

Code: Select all

Dialogue System: Lua code '{"scene":1,"position":{"x":4.323111057281494,"y":0.6873067617416382,"z":0.0},"rotation":{"x":0.0,"y":0.7074729800224304,"z":0.0,"w":0.7067404389381409}}' threw exception 'Code has syntax errors:
Line 1, Col 1 '{': Failed to parse Letter of Name.
Line 1, Col 1 '{': Failed to parse Name of VarName.
Line 1, Col 1 '{': Failed to parse 'nil' of NilLiteral.
Line 1, Col 1 '{': Failed to parse Text of BoolLiteral.
Line 1, Col 1 '{': Failed to parse '0'...'9' of Digit.
Line 1, Col 1 '{': Failed to parse (Digit)+ of FloatNumber.
Line 1, Col 9 ':': Failed to parse '}' of TableConstructor.
Line 1, Col 1 '{': Failed to parse Name of VariableArg.
Line 1, Col 1 '{': Failed to parse firstTerm of OperatorExpr.
Line 1, Col 1 '{': Failed to parse Expr of ExprStmt.
Line 1, Col 1 '{': Failed to parse remaining input.
'
UnityEngine.Debug:LogError (object)
PixelCrushers.DialogueSystem.Lua:RunRaw (string,bool,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:252)
PixelCrushers.DialogueSystem.Lua:Run (string,bool,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:131)
PixelCrushers.DialogueSystem.Lua:Run (string,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Lua/Lua Wrapper/Lua Interpreter/Lua.cs:141)
PixelCrushers.DialogueSystem.PersistentDataManager:ApplyLuaInternal (string,bool) (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/PersistentDataManager.cs:263)
PixelCrushers.DialogueSystem.DialogueSystemSaver:ApplyDataImmediate () (at Assets/Plugins/Pixel Crushers/Dialogue System/Scripts/Save System/DialogueSystemSaver.cs:81)
PixelCrushers.SaveSystem:ApplyDataImmediate () (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:1018)
PixelCrushers.SaveSystem/<LoadSceneCoroutine>d__135:MoveNext () (at Assets/Plugins/Pixel Crushers/Common/Scripts/Save System/SaveSystem.cs:992)
UnityEngine.SetupCoroutine:InvokeMoveNext (System.Collections.IEnumerator,intptr)
From my testing, this error only occurs when the Position Saver is enabled on the player character.
Is there any way to resolve this issue?

Re: Error Occurred When Loading Game Using Save System

Posted: Fri Feb 21, 2025 8:02 am
by Tony Li
Hi,

Make sure all of your savers (Position Saver, Dialogue System Saver, etc.) have unique Key values. Otherwise they'll overwrite each others' save data. Then when you load a game the saver will get the wrong data and not know how to handle it.

Re: Error Occurred When Loading Game Using Save System

Posted: Fri Feb 21, 2025 8:12 am
by illusorys
But Position Saver, Dialogue System Saver and Player Prefs Saved Game Data Storer have all been set to the same key

Re: Error Occurred When Loading Game Using Save System

Posted: Fri Feb 21, 2025 8:20 am
by Tony Li
Hi,

PlayerPrefs Saved Game Data Storer shouldn't have a key at all.

Position Saver and Dialogue System Saver should have keys that are different from each other. For example, if the Position Saver is on the player GameObject, set the Position Saver's Key to "playerPosition". Set the Dialogue System Saver's Key to "ds". Then save a new game and try to reload it.

Re: Error Occurred When Loading Game Using Save System

Posted: Fri Feb 21, 2025 8:30 am
by illusorys
I see, sorry for misunderstanding your point. Anyway, it's working fine now. Thank you!

Re: Error Occurred When Loading Game Using Save System

Posted: Fri Feb 21, 2025 8:35 am
by Tony Li
Glad to help!