Questions When Changing Scenes

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Questions When Changing Scenes

Post by nitrox32 »

I'm using Scene Portal to change scenes. When I go from one scene to the next my player spawns at the correct position then for some reason the old scene reloads and the scenes keep flipping back and forth.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Questions When Changing Scenes

Post by Tony Li »

In the new scene, did you put the spawnpoint inside a scene portal that leads back to the old scene?

If so, just move the spawnpoint slightly outside the scene portal's trigger collider.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Questions When Changing Scenes

Post by nitrox32 »

No they are in completely different places. For instance, I have a dungeon entrance with a scene portal from an outdoor scene that leads to the beginning of the dungeon scene. At the end of the dungeon level I have a portal that leads to a completely different place in the outdoor scene. Each one of the triggers and spawn points have different names. Going into the dungeon works fine. Coming out the player goes to the new spawn point, then the scenes start flipping back and forth.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Questions When Changing Scenes

Post by Tony Li »

Does the player's design-time position in the scene overlap with a scene portal? When the new scene is loaded, the player starts in its original position. After one frame (to allow other components to initialize), the save system moves the player to the spawnpoint.

If you temporarily tick the Save System's Debug checkbox, does the Console window give you any helpful information?

Feel free to send a reproduction project to tony (at) pixelcrushers.com. I'll be happy to take a look directly.
nitrox32
Posts: 68
Joined: Sat Dec 01, 2018 10:41 am

Re: Questions When Changing Scenes

Post by nitrox32 »

I think I'm on the right track. After checking "pause during transition" in the standard scene transition manager this seemed to solve the problem. I didn't realized this was necessary. What does it do? Also, when I go into a scene all of my alert messages, whether part of a quest or not, begins displaying one by one until all of them have been displayed.
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Questions When Changing Scenes

Post by Tony Li »

I'm not sure why Pause During Transition made the difference, but it may be that your player character is able to run around during the transition and trigger another Scene Portal. If that's the case, ticking Pause During Transition is a fine solution.

Alternatively, you can disable the Scene Portal in the old scene as soon as it triggers. In the new scene, set the Scene Portal disabled at design time. Use a Timed Event component to enable the Scene Portal only after a certain duration. This is probably more complicated than you care to use, but I thought I'd mention it as an option.

Regarding the alert messages, are they triggered by Dialogue System Triggers set to OnTriggerEnter? If so, make sure to click the Use 'Player' Tag button to restrict the trigger to only GameObjects that are tagged 'Player'. (Make sure your player GameObject is tagged 'Player'.) Otherwise anything that's intersecting with the Dialogue System Trigger when the scene starts will trigger it.
Post Reply