Forum rules - please read before posting.

Ruh-roh! Got some problems with saving and loading

Hello!

I'm in the final, agonising bug-fixing stages before releasing The Last Time! To my chagrin, saving and loading is presenting me with some difficulties, with 3 categories of error that have been occurring during testing:

1. The game not correctly saving / loading the player character's order in sorting layer, so when loading one scene from another, the character disappears behind the background

2. The game not correctly saving / loading the current default player character, so when loading one scene from another, the player defaults to the wrong character

3. Music is now much easier to handle with the new music system (thanks again for that update!), but I found when loading scene B from scene A, the music that was playing in scene A carried on playing in scene B, even though that music wasn't playing in scene B at the time of save, and indeed has no way of playing in scene B without this error.

I haven't provided much info above, in case these are known issues for which there's an easy fix. But, if you do need any more info to go on (more details of the scenarios in which this occurs, copies of action lists, screenshots etc) then do let me know so I can make it as easy for you as possible to figure out! :)

Daniel

Comments

  • 1. The sorting order of the player shouldn't need saving/loading, as the FollowSortingMap attached to the sprite should assign the appropriate value.  Do you have any Remember components on the player, and are you locking the sprite's order (using the Character: Change rendering Action) at all?

    2. How are you switching characters?  Are you using the Player: Switch Action to select from a list created in the Settings Manager, or are you using the "player override" feature whereby if a player prefab is present in a scene file, then they'll become the player for that particular scene?

    3. Do both scenes have music?  The saving and loading of music should be automatic - I'll have to try to reproduce this myself.
  • Hi Chris, thanks so much for your response - 

    1. Yes, I've used Character: Change rendering to change the character's order in sorting layer in different scenes, which I'm guessing is the source of the problem. I don't have any remember scripts on the player.

    2. Yes, I'm switching characters using Player: Switch. I haven't knowingly activated the 'player override' feature - though, I suspect it may be in effect, because in the save game in which I've got the wrong character at a particular stage in the game, he does default to the correct character when walking through one particular scene - I've realised that this is a scene in which I'd accidentally left a player prefab (the correct player for that stage in the game).

    --- I've tested this a bit further and realised that it wasn't an issue with saving and loading at all - even when playing straight through without saving and loading, the player was reverting to the wrong character after leaving the scene with the correct character prefab in, even though I'd changed the character to the correct one using Player: Switch. I removed the player prefab from the scene, and this seems to have fixed it, but I'm not sure why. I'll test this some more and let you know.

    3. Scene B has no music - at least, none that was playing at the time of the save. Perhaps there's nothing telling the music to stop, or the fact that no music is playing is not saved?

    Best regards, and thanks again for the amazing support,

    Daniel
  • 1) And is the sorting order layer locked when saving / loading?

    2) Guide me all the detail you can regarding which player gets switched to in what scene, and what combination of saving/loading causes this issue.  e.g. "I start with Player 0 in Scene A, save, switch to Player 1 in Scene B, load, and Player 1 is in Scene A".

    3) The lack of music in the 2nd scene is the detail I needed, thanks.
  • Thanks again for your swift support, Chris. I've recorded a minute or two of footage which demonstrates problems 1) and 3), which I'll email to you. Hopefully will make things a bit clearer.

    1) I've had another look, and I haven't been changing or locking the sorting layer for the scenes in which the problem arises - but on further investigation, I think it might have something to do with the following:

    The sprite renderers for the sprite childs of my two different player characters have a different 'order in layer' value. 'Cop' sprite has an 'order in layer' of '0', and 'old man' player has an 'order in layer' of '-5'. I suspect that, when loading from an 'old man' scene to a 'cop' scene, the 'cop' is adopting 'old man's sorting layer of '-5', which would explain why he disappears behind sprites in layer -2 but not -10. I don't know why this would happen, though. Strangely, this doesn't always happen when I load a 'cop' scene from an 'old man' scene - it depends what 'old man' scene I'm loading from, even though no Action Lists are running in or between the tested 'old man' scenes which would change or lock his 'order in layer'. The footage I'm emailing you demonstrates the above, as well as demonstrating problem 3).

    2) This seems to be fixed now - as mentioned in my previous post, removing the player prefab from the scene I was testing has stopped the problem from happening again.

    Best regards,

    Daniel
  • FIXED, thanks to Chris - I'll leave the solution here for the benefit of anyone browsing this thread:

    Sorting layer issues were fixed by... making sure I actually had a sorting layer in all my scenes. 

    Music issue when saving / loading is apparently a bug that will be fixed in next update.

    Thanks again, Chris!
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.