Forum rules - please read before posting.

Possible save bug

Hello,

I am using Unity 5.3.5f1 and AC 1.52a.

When I save multiple times to different save slots it appears that each new save keeps all the old player data and appends a new copy of the current player data in the save file. Then when loading it only sees the first copy of the player data so I get weird results. I turned on JSON save files to be able to see this and here is an excerpt from my first and second saves in my game:

First save:
"playerData":[{"playerID":0,
"currentScene":0,
"previousScene":-1,
"currentSceneName":"Cottage",
"previousSceneName":"",
"openSubScenes":"",
"playerLocX":0.0,
"playerLocY":0.0,
"playerLocZ":0.0,
"playerRotY":0.0,
"playerWalkSpeed":0.0,
"playerRunSpeed":0.0,
"playerIdleAnim":"",
"playerWalkAnim":"",
"playerTalkAnim":"",
"playerRunAnim":"",
"playerWalkSound":"",
"playerRunSound":"",
"playerPortraitGraphic":"",
"playerSpeechLabel":"",
"playerDisplayLineID":0,
"playerTargetNode":0,
"playerPrevNode":0,
"playerPathData":"",
"playerIsRunning":false,
"playerLockedPath":false,
"playerActivePath":0,
"playerPathAffectY":false,
"lastPlayerTargetNode":0,
"lastPlayerPrevNode":0,
"lastPlayerActivePath":0,
"playerUpLock":false,
"playerDownLock":false,
"playerLeftlock":false,
"playerRightLock":false,
"playerRunLock":0,
"playerFreeAimLock":false,
"playerIgnoreGravity":false,
"playerLockDirection":false,
"playerSpriteDirection":"",
"playerLockScale":false,
"playerSpriteScale":0.0,
"playerLockSorting":false,
"playerSortingOrder":0,
"playerSortingLayer":"",
"inventoryData":"0:1",
"playerLockHotspotHeadTurning":false,
"isHeadTurning":false,
"headTargetID":0,
"headTargetX":0.0,
"headTargetY":0.0,
"headTargetZ":0.0,
"gameCamera":416446,
"lastNavCamera":416446,
"lastNavCamera2":412638,
"mainCameraLocX":-0.5,
"mainCameraLocY":2.0,
"mainCameraLocZ":-6.5,
"mainCameraRotX":29.437965393066408,
"mainCameraRotY":16.68213653564453,
"mainCameraRotZ":4.411433696746826,
"isSplitScreen":false,
"isTopLeftSplit":false,
"splitIsVertical":false,
"splitCameraID":0,
"splitAmountMain":0.0,
"splitAmountOther":0.0,
"followSortingMap":false,
"customSortingMapID":0}]

Second save, same 'playerData' variable:
"playerData":[{"playerID":0,
"currentScene":0,
"previousScene":-1,
"currentSceneName":"Cottage",
"previousSceneName":"",
"openSubScenes":"",
"playerLocX":0.0,
"playerLocY":0.0,
"playerLocZ":0.0,
"playerRotY":0.0,
"playerWalkSpeed":0.0,
"playerRunSpeed":0.0,
"playerIdleAnim":"",
"playerWalkAnim":"",
"playerTalkAnim":"",
"playerRunAnim":"",
"playerWalkSound":"",
"playerRunSound":"",
"playerPortraitGraphic":"",
"playerSpeechLabel":"",
"playerDisplayLineID":0,
"playerTargetNode":0,
"playerPrevNode":0,
"playerPathData":"",
"playerIsRunning":false,
"playerLockedPath":false,
"playerActivePath":0,
"playerPathAffectY":false,
"lastPlayerTargetNode":0,
"lastPlayerPrevNode":0,
"lastPlayerActivePath":0,
"playerUpLock":false,
"playerDownLock":false,
"playerLeftlock":false,
"playerRightLock":false,
"playerRunLock":0,
"playerFreeAimLock":false,
"playerIgnoreGravity":false,
"playerLockDirection":false,
"playerSpriteDirection":"",
"playerLockScale":false,
"playerSpriteScale":0.0,
"playerLockSorting":false,
"playerSortingOrder":0,
"playerSortingLayer":"",
"inventoryData":"0:1",
"playerLockHotspotHeadTurning":false,
"isHeadTurning":false,
"headTargetID":0,
"headTargetX":0.0,
"headTargetY":0.0,
"headTargetZ":0.0,
"gameCamera":416446,
"lastNavCamera":416446,
"lastNavCamera2":412638,
"mainCameraLocX":-0.5,
"mainCameraLocY":2.0,
"mainCameraLocZ":-6.5,
"mainCameraRotX":29.437965393066408,
"mainCameraRotY":16.68213653564453,
"mainCameraRotZ":4.411433696746826,
"isSplitScreen":false,
"isTopLeftSplit":false,
"splitIsVertical":false,
"splitCameraID":0,
"splitAmountMain":0.0,
"splitAmountOther":0.0,
"followSortingMap":false,
"customSortingMapID":0},
{"playerID":0,
"currentScene":0,
"previousScene":-1,
"currentSceneName":"Cottage",
"previousSceneName":"",
"openSubScenes":"",
"playerLocX":0.0,
"playerLocY":0.0,
"playerLocZ":0.0,
"playerRotY":0.0,
"playerWalkSpeed":0.0,
"playerRunSpeed":0.0,
"playerIdleAnim":"",
"playerWalkAnim":"",
"playerTalkAnim":"",
"playerRunAnim":"",
"playerWalkSound":"",
"playerRunSound":"",
"playerPortraitGraphic":"",
"playerSpeechLabel":"",
"playerDisplayLineID":0,
"playerTargetNode":0,
"playerPrevNode":0,
"playerPathData":"",
"playerIsRunning":false,
"playerLockedPath":false,
"playerActivePath":0,
"playerPathAffectY":false,
"lastPlayerTargetNode":0,
"lastPlayerPrevNode":0,
"lastPlayerActivePath":0,
"playerUpLock":false,
"playerDownLock":false,
"playerLeftlock":false,
"playerRightLock":false,
"playerRunLock":0,
"playerFreeAimLock":false,
"playerIgnoreGravity":false,
"playerLockDirection":false,
"playerSpriteDirection":"",
"playerLockScale":false,
"playerSpriteScale":0.0,
"playerLockSorting":false,
"playerSortingOrder":0,
"playerSortingLayer":"",
"inventoryData":"1:1",
"playerLockHotspotHeadTurning":false,
"isHeadTurning":false,
"headTargetID":0,
"headTargetX":0.0,
"headTargetY":0.0,
"headTargetZ":0.0,
"gameCamera":188128,
"lastNavCamera":188128,
"lastNavCamera2":180686,
"mainCameraLocX":11.819999694824219,
"mainCameraLocY":1.0,
"mainCameraLocZ":14.119999885559082,
"mainCameraRotX":40.00000762939453,
"mainCameraRotY":324.5,
"mainCameraRotZ":0.0,
"isSplitScreen":false,
"isTopLeftSplit":false,
"splitIsVertical":false,
"splitCameraID":0,
"splitAmountMain":0.0,
"splitAmountOther":0.0,
"followSortingMap":false,
"customSortingMapID":0}]

Hoping there is something I can do to figure out why this is happening and fix it. You'll note that in the second save the second set of player data has a new gameCamera and list of inventory items but when I load the second save I end up with the first player entry gameCamera and inventory.

Thanks!

Comments

  • Digging through the code (for which I'm very thankful BTW) it appears this is because I don't have a Player set in the Character settings. On line 955 of SaveSystem.cs it only removes previous save data if there is a player object (although it doesn't require a player to save data.)

    I guess I didn't think I needed a player character as I'm just using hotspots to move around in first person mode and there is no actual object that needs to move around but I suppose I need to create one for saving to work. I'll dig into how to do that tomorrow.
  • edited August 2016
    Thanks for posting this.  I'll have to look into it more thoroughly but it does indeed sound like a bug.  In the meantime, creating an "empty" Player with no graphics should be enough - the Character Wizard will expect some, but simply attaching a Player script to a GameObject, prefabbing it, tagging it as Player will be enough to then assign it in the Settings Manager.
  • You're welcome. Thank you for the quick response. Adding the player as you described has fixed my save problem. Thank you!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.