Spawnpoint in scene change not persisting

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
MaddyOSaurus
Posts: 7
Joined: Sun Nov 21, 2021 8:17 pm

Spawnpoint in scene change not persisting

Post 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 397 times
logs.PNG
logs.PNG (31.3 KiB) Viewed 397 times
dialoguesystem.PNG
dialoguesystem.PNG (56.74 KiB) Viewed 397 times
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawnpoint in scene change not persisting

Post 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?
MaddyOSaurus
Posts: 7
Joined: Sun Nov 21, 2021 8:17 pm

Re: Spawnpoint in scene change not persisting

Post 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?
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawnpoint in scene change not persisting

Post 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.
MaddyOSaurus
Posts: 7
Joined: Sun Nov 21, 2021 8:17 pm

Re: Spawnpoint in scene change not persisting

Post 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 390 times
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawnpoint in scene change not persisting

Post 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?
MaddyOSaurus
Posts: 7
Joined: Sun Nov 21, 2021 8:17 pm

Re: Spawnpoint in scene change not persisting

Post by MaddyOSaurus »

The spawnpoint never happens. I go straight to the default player position. Before it was a half-second of spawnpoint first.
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawnpoint in scene change not persisting

Post 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?
MaddyOSaurus
Posts: 7
Joined: Sun Nov 21, 2021 8:17 pm

Re: Spawnpoint in scene change not persisting

Post by MaddyOSaurus »

Sent! Thank you :)
User avatar
Tony Li
Posts: 21681
Joined: Thu Jul 18, 2013 1:27 pm

Re: Spawnpoint in scene change not persisting

Post 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.
Post Reply