Scene Portal Issue

Announcements, support questions, and discussion for the Dialogue System.
magique
Posts: 12
Joined: Sat Jun 16, 2018 5:45 pm

Scene Portal Issue

Post by magique »

I'm trying to use the ScenePortal provided with Dialogue System, but it's having an issue. I set up the portal as the instructions explain and am referencing the name of the spawn point in the scene to be loaded, but the character simply appears in the new scene at the same position he was in the previous scene instead of at the spawn point.

I'm using Invector on Unity 2017.4.3f1.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Portal Issue

Post by Tony Li »

Hi,

Here are some things to check:
  • Dialogue Manager GameObject has a Save System component. Temporarily tick Debug so you can see messages like:

    Code: Select all

    Save System: Loading scene TestScene2 [spawn at TestSpawnpoint]
  • Spawnpoint name in Scene Portal component exactly matches spawnpoint GameObject name in new scene, including capitalization.
  • Player GameObject in both scenes has a Position Saver component with:
    • Key set to "Player"
    • Save Across Scene Changes ticked.
    • Use Player Spawnpoint ticked.
Not all of those settings are absolutely required, but it will put us on the same baseline if we need to investigate this further.

Here's an example: DS2_TestInvectorScenePortal_2018-06-18.unitypackage

Add TestScene1 & TestScene2 to your build settings. Then play TestScene1. There is a cube to the left of the player that will take you to TestScene2.

The next batch of tutorial videos will include a Save System tutorial, which should make this clearer.
magique
Posts: 12
Joined: Sat Jun 16, 2018 5:45 pm

Re: Scene Portal Issue

Post by magique »

OK, I'll try that when I get home. I did not add any scene saving stuff at all and was just trying out the portaling. Maybe it requires the saving stuff and you did not realize it.
magique
Posts: 12
Joined: Sat Jun 16, 2018 5:45 pm

Re: Scene Portal Issue

Post by magique »

I also found another issue that may not have been considered. If using the Footstep system from Invector it gets a reference to the Terrain in the scene and uses that to get the textures for footsteps sounds. But when the scene changes, the reference is no longer valid. There needs to be some way to re-assign the terrain in the new scene. I'll probably have to write some custom code for that, but it's something you may not be aware of.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Portal Issue

Post by Tony Li »

Hi,

Footsteps seem to work fine in the example I posted above. If you notice something different, please let me know.

Sorry about the confusion with Scene Portals. They're part of the Save System. This is because we need to save information in the old scene before switching to the new scene. This way we can restore that information when returning to the old scene. You can read more about the Save System in the manual, which is in Plugins / Pixel Crushers / Common / Documentation / Save_System_Manual.pdf.
magique
Posts: 12
Joined: Sat Jun 16, 2018 5:45 pm

Re: Scene Portal Issue

Post by magique »

No problem I was just fast tracking some testing and didn't need the save system yet. I will go ahead and put all that in there tonight then. Thanks for your help as always.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Portal Issue

Post by Tony Li »

Glad to help!

For the Save System, you only need to add a Save System component to the Dialogue Manager and a Position Saver to your player.
magique
Posts: 12
Joined: Sat Jun 16, 2018 5:45 pm

Re: Scene Portal Issue

Post by magique »

I added the save components and now the portaling works correctly to the right spawn point. However, the terrain issue is still there with the Footsteps. Your test example works because there is no terrain in those scenes. Try with a terrain in both scenes and you will see the issue.

[EDIT]
I fixed the issue with footsteps by modifying Invector code to re-acquire the terrain if it goes null. I'm not sure you would be able to provide a fix on your end anyway since it's the Invector code that is at fault.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Portal Issue

Post by Tony Li »

I've made a note to add a "Saver" component that reacquires the terrain if possible. This will be in a future release of the Dialogue System. Then you'll only need to add this component to your player, and you won't need custom edits in the Invector code.
magique
Posts: 12
Joined: Sat Jun 16, 2018 5:45 pm

Re: Scene Portal Issue

Post by magique »

You won't be able to fix it on your end, but we could ask Invector to provide an update. Currently, the terrain references are private and only acquired on the Start function. So there's no way for you to force it to re-acquire.
Post Reply