Bug: transitions loop

What happens for me after those changes is. The position is saved in scene 0 when scene 1 loads. Then I enter in any portal in scene 1, that position is also saved for the scene. So far so good. However when I transition back to scene 0, the position is set to the saved one and immediately a transition to scene 1 happens, where immediately a transition to scene 0 happens, due to the same problem and I get into a transition loop. I am not sure why it works for the code in this lecture, but logically the transition loop I described would happen. Any ideas?

Update: This issue gets fixed later when we also save after the transition to get the checkpoint at the new scene. However this still doesn’t explain how it works in the video before and it doesn’t for me.

As far as I can remember, we set the spawn position away from the trigger, and we move the player to the spawn point when we move through the portal. That way, the player does not start inside the trigger when the scene is loaded and we don’t get into a transition loop

That is correct, however the saved checkpoint location is inside the trigger, so when you return in the saved scene you’re briefly inside the trigger before the player moves to the spawn point.

Actually, the saved checkpoint location is inside the trigger in the scene you came from, as the Player save data is updated across all scenes… so unless your scene geometry is such that the trigger for the portal you came from is in the exact same location in the scene you’re teleporting to, you shouldn’t be spawning/relocating inside of the trigger.

Oh yeah then it shouldn’t have happened. I wonder if it was some weirdness because of me having the persistent Objects on scene before running the game (and the static ‘spawned’ boolean as it’s default false ofc). Anyway once the 2nd save was included it got fixed for me, so ended up the section with everything working :slightly_smiling_face:

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

Privacy & Terms