Questions on how to play video cut scene and change background

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
slothins
Posts: 13
Joined: Thu Oct 24, 2019 11:18 am

Questions on how to play video cut scene and change background

Post by slothins »

Hello,

I'm new to the asset, and I have a VN based history project in the works. I'm facing two issues:

1. I want to play a cut scene, in the form of a video. I've tried to use the SetActive() sequence, with a gameobject with a video player attached. I set it as false on the start node and then set it active after the dialogue choice. Nothing happens.

2. I'm trying to figure out how to also change the background. I've also tried to use the SetActive() sequence but nothing happens.

Attached is the inspector for the video GameObject. Would appreciate any help ASAP!
Attachments
Video.PNG
Video.PNG (28.88 KiB) Viewed 672 times
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Questions on how to play video cut scene and change background

Post by Tony Li »

Hi,

Thanks for using the Dialogue System!

If you're using version 2.2.1, please update to version 2.2.2. There was a SetActive() bug specifically in 2.2.1.
slothins
Posts: 13
Joined: Thu Oct 24, 2019 11:18 am

Re: Questions on how to play video cut scene and change background

Post by slothins »

Hey, thanks for replying so fast!

I did that this morning, and its still not working. I think it's an issue with how I did it.

The disable GameObject node is in an empty node right after the Start node.
The text in the sequence field is:

Code: Select all

SetActive(GameObject, false);
The text in the later node is:

Code: Select all

SetActive(GameObject, true);
The GameObject itself is smack in the middle of the scene, and it now freezes on the text line after the GameObject is set to true, maybe its playing it but isn't shown in the Camera?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Questions on how to play video cut scene and change background

Post by Tony Li »

Hi,

Is the GameObject named "GameObject" becoming inactive when the conversation starts, and active again when it hits that node?

Are there any errors or warnings in the Console window?

During play, select menu item Edit > Project Settings > Time. Keep an eye on the Time Scale value. If it drops to zero, this means something is pausing the game.

As a test, what if, instead of the video GameObject, you set a different GameObject inactive and active again, one without a Video Player component? Let's make sure the Video Player isn't causing the issue.

You can also set the Dialogue Manager's Debug Level to Info. This will log all of the sequencer commands to the Console. It might give you some insight into what's happening.

If you've enabled continue buttons, you might want to add this command (the second line below):

Code: Select all

SetActive(GameObject, true);
Continue()
This will auto-advance the conversation past that node.
slothins
Posts: 13
Joined: Thu Oct 24, 2019 11:18 am

Re: Questions on how to play video cut scene and change background

Post by slothins »

Tony Li wrote: Sun Oct 27, 2019 6:31 pm Hi,

Is the GameObject named "GameObject" becoming inactive when the conversation starts, and active again when it hits that node?

Are there any errors or warnings in the Console window?

During play, select menu item Edit > Project Settings > Time. Keep an eye on the Time Scale value. If it drops to zero, this means something is pausing the game.

As a test, what if, instead of the video GameObject, you set a different GameObject inactive and active again, one without a Video Player component? Let's make sure the Video Player isn't causing the issue.

You can also set the Dialogue Manager's Debug Level to Info. This will log all of the sequencer commands to the Console. It might give you some insight into what's happening.

If you've enabled continue buttons, you might want to add this command (the second line below):

Code: Select all

SetActive(GameObject, true);
Continue()
This will auto-advance the conversation past that node.
I went ahead and removed some useless objects in my scene, and cleaned things up a bit. Now the GameObject is toggling properly. My next question would be how to get the camera to actually see the cutscene? I've tried enabling a secondary camera and disabling the main/sequencer ones, but to no avail. I seem to have a similar issue with the background. I can now enable/disable the object, but I have no idea where the camera that is focusing on the conversation is, even in the scene. And why does it ignore everything that isn't presented in the dialogue manager?
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Questions on how to play video cut scene and change background

Post by Tony Li »

Is your camera tagged "MainCamera"?

If not, then during conversations the Dialogue System will use a temporary camera so you can use Camera() sequencer commands. If you've assigned a camera to the Dialogue Manager's Sequencer Camera field, it will use that instead of creating a temporary one. But if Sequencer Camera is unassigned and your camera is tagged MainCamera, then it will not create a temporary camera.

By default, the Dialogue Manager's dialogue UI uses a Screen Space - Overlay canvas. (You can of course change this.) This canvas is overlaid on top of the camera view(s). It doesn't use a camera.
slothins
Posts: 13
Joined: Thu Oct 24, 2019 11:18 am

Re: Questions on how to play video cut scene and change background

Post by slothins »

Tony Li wrote: Tue Oct 29, 2019 11:15 am Is your camera tagged "MainCamera"?

By default, the Dialogue Manager's dialogue UI uses a Screen Space - Overlay canvas. (You can of course change this.) This canvas is overlaid on top of the camera view(s). It doesn't use a camera.
I didn't have the camera properly tagged, and placing the background sprites in the Canvas fixed the background issue! As for the Cutscene, I get it to play and all but I need it to play in front of the UI. I tried placing it under the Canvas and changing the order in the hierarchy, and also giving it its own canvas component, ticking Override Sorting and changing the Order in Layer still doesn't work.
User avatar
Tony Li
Posts: 22055
Joined: Thu Jul 18, 2013 1:27 pm

Re: Questions on how to play video cut scene and change background

Post by Tony Li »

If the cutscene uses scene objects such as 3D models, sprites, or world-space canvases, they will always be underneath the dialogue UI. Unity always draws screen-space overlay UIs on top of scene objects. (But see the bottom of this post if you're using Video Player.)

You can use the SetDialoguePanel() sequencer command to hide and show the dialogue UI. For example, use a Sequence like this to start the cutscene:

Code: Select all

SetDialogueUI(false);
SetActive(GameObject)
And when returning to the conversation:

Code: Select all

SetDialogueUI(true); {{default}}
(The {{default}} keyword tells the Sequence to include the Dialogue Manager's Default Sequence, too.)

Video Player:
If your cutscene runs entirely in the Video Player, you can add a Raw Image to a Canvas. Then assign the Video Player's render texture to this Raw Image. This will make it play the video inside the Canvas, which you can set to a higher Sort Order than the Dialogue Manager's Canvas.
slothins
Posts: 13
Joined: Thu Oct 24, 2019 11:18 am

Re: Questions on how to play video cut scene and change background

Post by slothins »

Sorry for the late response. This fixed my issue!
Post Reply