Page 1 of 1

Spawnpoint in scene change not persisting

Posted: Sun Nov 21, 2021 8:34 pm
by MaddyOSaurus
Hi there,

I've done my best to follow the video tutorial and copy the demo scene, but I'm getting some weird behaviour when I try to switch scenes. The scene switch works, and I get a brief flash of being at the right spawnpoint, but then it seems something else takes over and drops me back at the player's default position. This happens in both the scenes I'm switching between.

I've attached photos of the position saver on the player as well as the dialogue system and info logs.

Any help would be very appreciated! :)
player2.PNG
player2.PNG (13.17 KiB) Viewed 402 times
logs.PNG
logs.PNG (31.3 KiB) Viewed 402 times
dialoguesystem.PNG
dialoguesystem.PNG (56.74 KiB) Viewed 402 times

Re: Spawnpoint in scene change not persisting

Posted: Sun Nov 21, 2021 8:38 pm
by Tony Li
Hi,

Is the player appearing for a flash at the spawnpoint or the position where you placed the player at design time?

If it's appearing at the spawnpoint, then the Position Saver is moving it there. Is some other, non-Dialogue System script maybe taking control of the player GameObject and moving it elsewhere after that?

Re: Spawnpoint in scene change not persisting

Posted: Sun Nov 21, 2021 8:43 pm
by MaddyOSaurus
It's appearing at the spawnpoint for about half a second, and then getting moved to the default position where it's placed in the scene. I don't know of any other scripts I have on the player that would be affecting it--do you have any examples of what types of external scripts may interfere?

Re: Spawnpoint in scene change not persisting

Posted: Sun Nov 21, 2021 9:05 pm
by Tony Li
As a test, try removing the Position Saver component. This will just make sure that it's the Position Saver that's moving the player to the spawnpoint. If the player doesn't go to the spawnpoint after you remove the Position Saver, then we know the Position Saver was doing its job properly.

While the Position Saver is removed, you may see that the player appears at its original design-time position and then something else moves it elsewhere. If so, are you using any particular character controller or game framework? Maybe it's taking control of the player's position.

Re: Spawnpoint in scene change not persisting

Posted: Sun Nov 21, 2021 11:46 pm
by MaddyOSaurus
Thanks so much for helping :)

When I take off the position saver, it does indeed stop the flash from the spawnpoint.

I'm just using the default Unity FPSController, but I guess it's a different one (instance?) in each scene. Would that matter? I also don't have any explicit save data that I've created (like hitting save from a menu).

As far as I can think, I don't have any scripts at all that would affect the player. I've attached the full view of it from the inspector.
fullplayer.PNG
fullplayer.PNG (79.25 KiB) Viewed 395 times

Re: Spawnpoint in scene change not persisting

Posted: Mon Nov 22, 2021 8:44 am
by Tony Li
Hi,
MaddyOSaurus wrote: Sun Nov 21, 2021 11:46 pmWhen I take off the position saver, it does indeed stop the flash from the spawnpoint.
Can you clarify this, please? Do you mean the player properly appears at the spawnpoint and stays there? Or the player never appears at the spawnpoint?

Re: Spawnpoint in scene change not persisting

Posted: Mon Nov 22, 2021 7:20 pm
by MaddyOSaurus
The spawnpoint never happens. I go straight to the default player position. Before it was a half-second of spawnpoint first.

Re: Spawnpoint in scene change not persisting

Posted: Mon Nov 22, 2021 8:32 pm
by Tony Li
Okay, great. Thanks for confirming that. Unfortunately I can't determine from the information available what script is moving the player after that. Would it be possible for you to send a reproduction project to tony (at) pixelcrushers.com?

Re: Spawnpoint in scene change not persisting

Posted: Tue Nov 23, 2021 4:31 am
by MaddyOSaurus
Sent! Thank you :)

Re: Spawnpoint in scene change not persisting

Posted: Tue Nov 23, 2021 9:38 am
by Tony Li
Thank you for sending the reproduction project and clear reproduction steps.

Select menu item Edit > Project Settings. In the Physics section, tick Auto Sync Transforms. This will allow the FPSController's CharacterController component to pick up position changes from scripts such as the Dialogue System's Position Saver.