Page 1 of 1

Running C# method in the middle conversation nodes?

Posted: Tue Dec 19, 2017 5:38 am
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?

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

Posted: Tue Dec 19, 2017 9:00 am
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}}

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

Posted: Tue Dec 19, 2017 10:42 pm
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

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

Posted: Tue Dec 19, 2017 11:09 pm
by ichisan
Sorry, one error is because i put double (;) in the command. But for sendmessage function still not work(it said null).

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

Posted: Tue Dec 19, 2017 11:57 pm
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 :)

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

Posted: Wed Dec 20, 2017 8:27 am
by Tony Li
Hi - Thanks for letting me know that you solved it.