Page 1 of 1

Scene Portal Issue

Posted: Sat Jul 11, 2020 2:23 pm
by lardmaster
Hi,

I'm having an issue with the scene portal where when I switch scenes using scene portal and spawn my character at a spawnpoint that is different from where the character is placed before the game starts, the character will teleport there and the camera will follow the character as it teleports there creating a very jarring camera motion.



I was wondering if there was a way for this to be fixed so that the player would spawn at the spawnpoint without the jerky camera motion or the player would simply spawn at the last place they were at before switching scenes.

Thanks for any help!

Re: Scene Portal Issue

Posted: Sat Jul 11, 2020 4:30 pm
by EnigmaFactory
I always build in 1 scene so I'd have to think and see if I can be helpful here, but I just need to say first, this looks awesome! Subscribed and liked. Hope to see more.

First thing I think is reset camera transform to player on load in.

Re: Scene Portal Issue

Posted: Sat Jul 11, 2020 9:04 pm
by Tony Li
Hi,

There are a few things you can do:

1. Reduce the number of frames the save system waits before applying saved data, including moving the player to its spawnpoint. Inspect the Save System component, and set Frames To Wait Before Apply Data. If all of your scripts initialize in Awake, you can set this to zero. If you have scripts that initialize in Start using a multi-frame coroutine, or otherwise take more than one frame to initialize, you may need to set it higher than zero. But the lower you can make it, the better.

2. Add a Scene Transition Manager component that fades in from black so the player doesn't see the camera moving into position. See DemoScene1 for an example.

3. When the scene starts, and after the Frames To Wait Before Apply Data, snap the camera to its spawnpoint position. For example, if you're using Cinemachine, you can used a Timed Event component to disable and re-enable it. This should get it to reset immediately to its goal position.