Running C# method in the middle conversation nodes?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

Running C# method in the middle conversation nodes?

Post by ichisan »

Hello devs,
I want to run a C# method in game object for camera transition shader effect in the middle of dialogue, (actually when enter one of conversation nodes). I thought of using events but it can't run the script that is component of gameobject (can only run object type).
Is there an easy way to do this?
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Running C# method in the middle conversation nodes?

Post by Tony Li »

Yes, make a custom sequencer command. Here are the steps:

1. Make a copy of Scripts / Templates / SequencerCommandTemplate.cs. For example, let's say you name it SequencerCommandShaderEffect.cs.

2. Edit the script, and fill in your code where the comments indicate.

3. In your conversation node's Sequence field, add:

Code: Select all

ShaderEffect()
If you want to also use the default sequence defined on the Dialogue Manager (which delays for a duration based on the subtitle length unless you've changed it), set the Sequence field to:

Code: Select all

ShaderEffect();
{{default}}
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

Re: Running C# method in the middle conversation nodes?

Post by ichisan »

Hi Toni, thank you for your answer,
I try to follow what the doc said, and it gives me 2 error, and it seems it didn't run the function in the script too,
Can you please tell me what did I do wrong?
Thank you
Attachments
arx.JPG
arx.JPG (197.5 KiB) Viewed 605 times
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

Re: Running C# method in the middle conversation nodes?

Post by ichisan »

Sorry, one error is because i put double (;) in the command. But for sendmessage function still not work(it said null).
ichisan
Posts: 10
Joined: Thu Dec 07, 2017 12:38 am
Location: Indonesia

Re: Running C# method in the middle conversation nodes?

Post by ichisan »

Hello Toni, thank you for answering. I already solve it. (I don't know if not using parameter I just using empty between comas:
sendmessages(function,,obj);
Thank you for your help, cheers :)
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: Running C# method in the middle conversation nodes?

Post by Tony Li »

Hi - Thanks for letting me know that you solved it.
Post Reply