CInemachinePriority () Question

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

CInemachinePriority () Question

Post by nathanj »

Hi Tony,

I'm trying to use the CinemachinePriority () sequencer command to toggle between player and NPC virtual cameras but can't get my head around it.

1: Do I need to have CinemachineCameraPriorityOnDialogueEvent attached to an NPC if I am controlling the virtual camera with SequencerCommandCinemachinePriority?

2: Does CinemachinePriority set the virtual camera's priority to 0 on end or do I need to manually set the priority level to 0 at the end of every node?

3: (Solved: Just found Response Menu Sequence Field :roll: )Beyond these questions, the main issue I'm having is triggering the player's virtual camera for responses. I would like it that when the PC Subtitles appear the camera cuts to the Player's virtual camera. Is the player's response node I have

Code: Select all

CinemachinePriority(PlayerCM);
 CinemachinePriority(TestCubeCM, 0);
{{default}}

with the hope that this enabled the Player's camera (PlayerCM)and disables the NPC's camera (TestCubeCM). But, this only enables the camera on the player for a fraction of a second after the response is triggered.


4: Does this look right for switching between NPC and Player virtual cameras? On the first NPC node, in the main Sequencer field, i have:

Code: Select all

CinemachinePriority(TestCubeCM);
 CinemachinePriority(PlayerCM, 0);
{{default}}
, and in the Response Menu Sequence field:

Code: Select all

CinemachinePriority(PlayerCM);
 CinemachinePriority(TestCubeCM, 0);
{{default}}

This works but I'm wondering if all the fields are necessary. This kind of relates to my questions 1 and 2. Sorry for another convoluted question.

Thanks again,
Nathan
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: CInemachinePriority () Question

Post by nathanj »

Hey Again,

Sorry for taking up so much space here. I ended up using this post as a trouble shooting system for figuring this out myself.

1: Pretty obviously, now, you don't need CinemachineCameraPriorityOnDialogueEvent if you are controlling the virtual cameras with CinemachinePriority(). The one thing, however, is you need to manually set the dialogue virtual cameras priority to 0

2: I don't believe that the CinemachinePriority sets to the camera priority to 0 on completion, hence the manual setting mentioned above.

3: Found out what the Response Menu Sequence Field does, finally.

4:I'm guessing that the manual setting of priority values through sequencer commands for enabling and disabling cameras is necessary.

5: So, now that I've solved all my issues I do have one question. If I use the Escape key to get out of a conversation the virtual cameras settings are not changed and my dialogue virtual camera remains with the highest priority. Can you think of a way to resolve this?

Again, sorry for the ramblings.

Nathan
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: CInemachinePriority () Question

Post by Tony Li »

Hi Nathan,

Here's what I recommend:

1. Open your conversation in the Dialogue Editor. Inspect the conversation's properties by clicking empty canvas space.
  • Tick Override Display Settings and Sequence Settings.
  • Set the conversation's Default Sequence to:

    Code: Select all

    CinemachinePriority(TestCubeCM, 99); 
    CinemachinePriority(PlayerCM, 0); 
    Delay({{end}})
    You can replace Delay({{end}}) with whatever your regular default sequence is. This will move the camera to TestCubeCM.
  • Set the conversation's Default Response Menu Sequence to:

    Code: Select all

    CinemachinePriority(TestCubeCM, 0); 
    CinemachinePriority(PlayerCM, 99)
    This will move the camera to PlayerCM.
2. Add a Cinemachine Camera Priority On Dialogue Event component to your player.
  • Set Trigger to OnConversation.
  • Assign PlayerCM to Virtual Camera.
  • Set On Start to 0.
  • Set On End to 100.
This will ensure that PlayerCM has priority 100 when the conversation ends, even if the player cancelled it by pressing Escape.
User avatar
nathanj
Posts: 303
Joined: Sat May 28, 2016 12:30 am

Re: CInemachinePriority () Question

Post by nathanj »

Thanks Tony!

Once again I am amazed at the depth and foresight of Dialogue System. I had no idea that there was the whole Override Display Settings for conversations. :D

Nathan
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: CInemachinePriority () Question

Post by Tony Li »

Glad to help! :-)
jrbourne
Posts: 32
Joined: Wed May 16, 2018 3:08 pm

Re: CInemachinePriority () Question

Post by jrbourne »

I cannot find the download for the timeline and cinemachine unitypackage that is referenced in the asset store. I am using Unity 2018.1. Does the package exist for cinemachine/timeline for the dialogue system?

Thanks,

JB
User avatar
Tony Li
Posts: 22059
Joined: Thu Jul 18, 2013 1:27 pm

Re: CInemachinePriority () Question

Post by Tony Li »

Hi,

It's included in the Dialogue System package now. You don't need to do anything to enable Timeline support; it's automatic. To enable Cinemachine support, import the Cinemachine Support package found in the Third Party Support folder. Make sure you've imported Cinemachine itself, too.
Post Reply