Page 1 of 1

Make SequencerCommand.cs GetSubject() prioritize children

Posted: Fri Apr 09, 2021 12:56 pm
by Strook
Hello!

Im having an issue right now using shared dialogue:

- I have one dialogue that used by multiple characters. I've assigned a generic actor from the Database. In this dialogue I have a lot sequencers command (AnimatorPlay, CinemachinePriority, LookAt, Timeline...)

-In my scenes I have multiples actors (with their hierarchy containing animators, virtual cams, transform used for sequences,...). Those actors each have a Dialogue Actor component with a unique name.

-I start this conversation assigning the transform of this unique actor from script like this:

Code: Select all

DialogueManager.StartConversation(targetConversation, this.transform, this.transform,entry);
It worked fine when I have had one instance of those actor in the scene. However with multiple ones, I start to get weird results.
For example if my sequence is :

Code: Select all

 CinemachinePriority(CM actorCam1, 999);
I was expecting the priority of the camera name "CM actorCam1" thats also a child of the current speaker to be changed, but unfortunately that's not what happens: it changes the priority of another random camera with the same name in my scene. Same thing for other sequencer commands like AnimatorPlay.


So my question is: Can I (and should I?) change the way the GetSubject() methods work in the SequencerCommand.cs, to try and first look for an transform with a matching name in children of the speaker first?

Thank you!

Re: Make SequencerCommand.cs GetSubject() prioritize children

Posted: Fri Apr 09, 2021 2:46 pm
by Tony Li
Hi,

Can you give each vcam a unique name containing the actor's name?

For example, say you have actors "Ann", "Bob", and "Carl".

Name their vcam GameObjects "CM Ann 1", "CM Bob 1", and "CM Carl 1".

Then use this sequencer command:

Code: Select all

CinemachinePriority(CM [var=Conversant] 1, 999);

Re: Make SequencerCommand.cs GetSubject() prioritize children

Posted: Sat Apr 10, 2021 10:55 am
by Strook
That could work indeed!

I would still love it they could share the same name (Its not only VCam, but also animator, objects with timelines and such), but I think you answer is probably the intended way sequences are meant to be used with shared dialogue and unique actors right?

Re: Make SequencerCommand.cs GetSubject() prioritize children

Posted: Sat Apr 10, 2021 11:41 am
by Tony Li
In most cases, you can specify a subject using a path, like: "Ann/CM actorCam1" or "Bob/CM actorCam1".

Re: Make SequencerCommand.cs GetSubject() prioritize children

Posted: Sat Apr 10, 2021 12:46 pm
by Strook
wow! :o

So in theory, this should work:

[var=Conversant]/mytargetObject

Thanks a lot for the Help Tony, that was really helpful