Change scenes

Announcements, support questions, and discussion for the Dialogue System.
User avatar
Tony Li
Posts: 22874
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change scenes

Post by Tony Li »

Hi,

Set a unique Key on your Saver.
Arctichorse9
Posts: 62
Joined: Wed Sep 25, 2024 11:26 pm
Location: New York City
Contact:

Re: Change scenes

Post by Arctichorse9 »

Thanks. Although that does not improve my ability to spawn at the soawn point rather than the player position, it does get rid of that error message. Can you direct me to any explanation of what those keys are for?
User avatar
Tony Li
Posts: 22874
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change scenes

Post by Tony Li »

Each Saver component saves its data in the save system under a lookup key value. If you don’t specify a key, it will use the GameObject name. If two savers on the same GameObject don’t have keys, they’ll overwrite each other’s data.

For the spawnpoint issue, if you’re comfortable using a code debugger to step through code, I can provide further steps. Otherwise I’ll need a reproduction project to help.
Arctichorse9
Posts: 62
Joined: Wed Sep 25, 2024 11:26 pm
Location: New York City
Contact:

Re: Change scenes

Post by Arctichorse9 »

Someone I'm making the game with is good at that and can try that next week. If that doesn't work I wouid be very happy to send you a reproduction project. Let's try stepping through the code first.
User avatar
Tony Li
Posts: 22874
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change scenes

Post by Tony Li »

Great! Put a breakpoint in Assets > Plugins > Pixel Crushers > Common > Scripts > Save System > Savers > PositionSaver.cs line 124, which is the first line of code in the ApplyData() method. Then reproduce the issue and step through the method to see if it calls the SetPosition() method to move the player to the spawnpoint. If so, step into the SetPosition() method to make sure it sets the position.

Also check the Console for a warning like: "Save System: Can't find spawnpoint..."
Arctichorse9
Posts: 62
Joined: Wed Sep 25, 2024 11:26 pm
Location: New York City
Contact:

Re: Change scenes

Post by Arctichorse9 »

Does using the Scene Portal Component instead of The Dialogue System Trigger save data across scenes?
User avatar
Tony Li
Posts: 22874
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change scenes

Post by Tony Li »

If you've set up the save system, the Scene Portal component will use it. This means it will save the savers in the outgoing scene, change scenes, and then update the savers in the newly-loaded scene.

I'm not sure what you mean by using a Dialogue System Trigger. If you're using it to run Actions > Play Sequence and then using the LoadLevel() sequencer command to change scenes using the Dialogue System Trigger, then it will work similarly to a Scene Portal.
Arctichorse9
Posts: 62
Joined: Wed Sep 25, 2024 11:26 pm
Location: New York City
Contact:

Re: Change scenes

Post by Arctichorse9 »

Yes, that's what I mean by using Dialogue System Trigger.

The odd thing is that the Portal component works perfectly and takes me to the indicated save point. Using LoadLevel() in the sequence as mentioned before, takes me to the Player's position not the save point.

So--I am saved! Because portal works. :)

But will still work through stepping through the LoadLevel() situation to see if can find out why its behavior is different.

Thank you so much for your patient help.
User avatar
Tony Li
Posts: 22874
Joined: Thu Jul 18, 2013 1:27 pm

Re: Change scenes

Post by Tony Li »

Are you specifying the spawnpoint in LoadLevel(), such as:

Code: Select all

LoadLevel(Scene 2, Door Spawnpoint)
(Edit: Removed quotation marks.)
Arctichorse9
Posts: 62
Joined: Wed Sep 25, 2024 11:26 pm
Location: New York City
Contact:

Re: Change scenes

Post by Arctichorse9 »

I don't have the quotation marks. I have it like this LoadLevel(Scene2, Door Spawnpoint). I will try with quotation marks. Thank you.
Post Reply