Hello, I've got a scene where two characters are talking in one room. After the conversation ends (let's call it convo1), it continues in another room (lets call that convo2). When convo1 ends, I'd like to fade out, fade in with a new background, and start convo2. Technically, I don't care if the conversations are separate from the dialogue database's perspective. I just want it to appear that way from the player's perspective. I also don't care if these are Unity scenes changing or just backgrounds swapping.
I've been looking around in the docs, the faq, and the forum for how to do this, but there's one piece of information that always seems to be missing: How do you know which conversation just triggered the event? I don't want every conversation that ends to fade out then in to convo2, just want that to happen after convo1. I've looked at https://www.pixelcrushers.com/dialogue_ ... ptMessages and none of them get the conversation as a parameter. I assume that means these are for reacting to all conversations, not a specific one.
Change scene when conversation ends
Re: Change scene when conversation ends
Hi,
You can check DialogueManager.lastConversationStarted to know what conversation was last started (in a C# script).
However, if you really want to do a scene change with fade in and fade out, I recommend using the LoadLevel() sequencer command in your conversation. You can either put it in the last node of convo1, or use a single conversation and put it on whatever node you want to change the scene. If you also set up the Dialogue Manager with the save system, including a Scene Transition Manager component, it will do a nice fade.
If you'd prefer to stay in the same scene, you can use Fade() and SetActive() sequencer commands to do the fade and background change. For example, the Sequence might look something like:
This will do the following:
You can check DialogueManager.lastConversationStarted to know what conversation was last started (in a C# script).
However, if you really want to do a scene change with fade in and fade out, I recommend using the LoadLevel() sequencer command in your conversation. You can either put it in the last node of convo1, or use a single conversation and put it on whatever node you want to change the scene. If you also set up the Dialogue Manager with the save system, including a Scene Transition Manager component, it will do a nice fade.
If you'd prefer to stay in the same scene, you can use Fade() and SetActive() sequencer commands to do the fade and background change. For example, the Sequence might look something like:
Code: Select all
Fade(stay,1);
SetActive(OldBackground,false)@1;
SetActive(NewBackground,true)@1;
Fade(in,1)@1
- At 0:00, it will fade out to black over 1 second and stay faded out.
- At 0:01, it will deactivate the GameObject "OldBackground".
- At 0:01, it will activate the GameObject "NewBackground".
- At 0:01, it will fade in over 1 second.
Re: Change scene when conversation ends
Perfect! All that information is critical, but that is especially useful for me to know about. If I wasn't asking about it for this question, I'd be asking about it for another question later Thanks again!
Code: Select all
DialogueManager.lastConversationStarted
Re: Change scene when conversation ends
You're welcome!