Scene Transitions are Mixing

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pastirma
Posts: 2
Joined: Wed May 29, 2019 6:01 pm

Scene Transitions are Mixing

Post by pastirma »

Hi,

I have one entry and two level scenes. One of two level scenes is copy of the first one. So second one Using a duplicated DM and the same D.Database. But this problem continues even if i use two seperate scenes and DMs.

I have a SceneManager Script for all three scenes, attached to an emtpty game objects seperately in each scene and buttons are getting functions from that game objects and from the script.

I have an entry scene for scene selection with two buttons: Go To level1 and Go To Level2 buttons.

Buttons use these funtions to load scenes:

int firstLevel = 1000;

int secondLevel: 500;

public void LoadFirstLevel(string scene)
{

SceneManager.LoadScene(scene);
DialogueManager.displaySettings.dialogueUI.GetComponentInParent<Canvas>().enabled = true;
PixelCrushers.SaveSystem.LoadFromSlot(firstLevel);

}

Also the second line of this function:DialogueManager.displaySettings.dialogueUI.GetComponentInParent<Canvas>().enabled = true; gives null exception in unity but it still runs: Object reference not set to an instance of an object.


the scond button uses LoadSecondLevel() funtion with int secondlevel = 500; variable. So instead of writing numbers to PixelCrushers.SaveSystem.LoadFromSlot(firstLevel); i named the numbers, it should not be a problem i guess.


Now İf i go to first scene I have another Go Back Home button in that scene: public void GoHomeFromFirstLevel(string scene)

{
PixelCrushers.SaveSystem.SaveToSlot(firstLevel);

DialogueManager.StopConversation();
SceneManager.LoadScene(scene);
DialogueManager.displaySettings.dialogueUI.GetComponentInParent<Canvas>().enabled = false;
}

I am using GoHomeFromSecondLevel() as well.

With this button i can go back to entry scene, and when i press go to level 1 button again in entry scene it works great. It loads both scenes, saves the dialogues etc. every time.

But problem start when i go to one scene and go back to entry scene and try to go to second/another scene. Everything mixes at this point.

For example: entry>level1>entry>level1>entry works fine

entry>level2>entry>level1 or it mixes all scenes like canvas from previous scene and background is from loaded scene... Maybe mixing canvases from this line: DialogueManager.displaySettings.dialogueUI.GetComponentInParent<Canvas>().enabled = true;

it can not differentiate the canvases so maybe it opens second scene with the first levels' canvas?

entry>level1>entry>level2 is a problem, it mixes 2 scenes. it tries to run level2 but in a bugged way.


how can i solve the problem?

What i try to do is: Open Game: choose a scene to play: 1 or 2
lets say you choose 1, play it for a while and in the middle of the game:
Go back to home scene and either go back to level1 or try level2.

While switching between levels it should keep it saved, and player should be playin the from the last point and last dialogue for each seperate scene.
User avatar
Tony Li
Posts: 22056
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Transitions are Mixing

Post by Tony Li »

Hi,

If the second line runs into an error, then the third line will not run. The method will exit at the line where it ran into the error. Try commenting out that line as a test.

If that doesn't help, can you please send a reproduction project to tony (at) pixelcrushers.com? I'm having a little trouble understanding what you want to do. Thanks.
pastirma
Posts: 2
Joined: Wed May 29, 2019 6:01 pm

Re: Scene Transitions are Mixing

Post by pastirma »

Dear Tony i have sent the project, thank you very much.

Kind regards,
Evren Buda
Tony Li wrote: Wed May 29, 2019 9:14 pm Hi,

If the second line runs into an error, then the third line will not run. The method will exit at the line where it ran into the error. Try commenting out that line as a test.

If that doesn't help, can you please send a reproduction project to tony (at) pixelcrushers.com? I'm having a little trouble understanding what you want to do. Thanks.
Post Reply