Save Location Doesnt work when i change Scene

Dont know if thats how it suppose to work and we fix it l8r but if i save on Scene 1 and go to Scene 2 then back to Scene 1 and load() my character moves up and left of the Terrain. Not in the Same location to where i saved.

When you move between scenes, any saved location of the player is overwritten because we are using “player” as the identifier in SaveableEntity for the player.
So whether or not you saved in scene 1, when you transition to scene 2, your new save is at the spawnpoint of the portal that you were transported to in scene 2. When you transition back to scene 1, your new save point should be the spawnpoint of the portal you transported to in scene 1.

Is this where the character is transported to?

Ok so I save for example in the middle of them map in Scene 1. Then i move to Portal and going to Scene 2. Then i move back to Scene 1 and i am where i have set up the portal Waypoint ( exactly what it should happen). So now i am back to Scene 1 and if i press L (load()) it moves me at the Up Right corner of the map not at the middle where i had saved before.

UPDATE i did the last 2 lessons where we save the position upon entering a scene so now the load make me go into the Portal Waypoint.

If i save move a bit on same scene , close game then play again and load it will move me exactly at the position i had saved.

So now the issue have been fixed. But it kinda feel that our save has been overwritten by the Change Scene Save. I guess i will watch the next Save Section and gather more info.

When you moved back to scene 1, the new L return position should have been the Portal spawnpoint… so something’s not wiring up correctly with the restoration of the character position (I’m going to bet that if you look at the player in your scenario, his new position is 0,0,0… What happens with the enemies locations when you press L?

Paste in your Mover.cs CaptureState() and RestoreState() and we’ll take a look.

made an Edit Update on the above post @Brian_Trotter .

Atm i dont have that issue spawning me on the edge of the map because each time i change scene it saves the last waypoint of the Portal.

The only concern i have is that my Manual save its being overwritten by the auto.
And one example i would try to give here is lets say we play a same RPG . If we make a save in a certain time and position if we load that it will move as to that Certain position on that certain scene.
If i remove the (auto)Save() btw portals from code and save the game in a certain position in Scene 1, if i change scene that location saved i have done is messed up even if i come back to the same Scene 1 and load the game.

Hope you get my point. Else i can post a video on Discord trying to explain.

Also thank you for the fast answers. You guys worth every penny for the courses and more.

Yes, the manual save is overwritten once you move through a portal. In the last course in the series we go through making a menu and choosing a save file, but it’s still structured that way. It wouldn’t be hard, however, to make a named save from that system.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms