Hello,
I'm using dialogue system for tutorials.
For example I have 5 dialog on 5 step. On 3nd step I want show hand icon on button.
When dialog reach step 5. iwant execute specific script from gameobject component.
Thank you.
Custom script execution
Re: Custom script execution
Hi,
There are 3 ways to accomplish custom script execution:
1. Cutscene Sequences. Use a sequencer command. You can use the built-in commands (reference) or write a custom command. For example, if your hand icon GameObject is named "Hand Icon" and you want to activate it in the 3rd dialogue entry node, set the 3rd dialogue entry node's Sequence to:
2. Or use Lua Functions. You can register your own C# methods with Lua. Then use it in the dialogue entry node's Sequence field.
3. Or connect your script method to the dialogue entry node's OnExecute() UnityEvent.
There are 3 ways to accomplish custom script execution:
1. Cutscene Sequences. Use a sequencer command. You can use the built-in commands (reference) or write a custom command. For example, if your hand icon GameObject is named "Hand Icon" and you want to activate it in the 3rd dialogue entry node, set the 3rd dialogue entry node's Sequence to:
Code: Select all
{{default}}; SetActive(Hand Icon)
3. Or connect your script method to the dialogue entry node's OnExecute() UnityEvent.
-
- Posts: 6
- Joined: Sun Oct 29, 2023 5:05 pm
Re: Custom script execution
Another question about it
Can you give me example of call custom script method ?
For example;
customComponent.customMethod("https://www.google.com")
Thank you very much.
Can you give me example of call custom script method ?
For example;
customComponent.customMethod("https://www.google.com")
Thank you very much.
Re: Custom script execution
There are many ways to do it. The two simplest ways, without having to write any code are:
1. Use the SendMessage() sequencer command. Assuming customMethod() is on a GameObject named "My GameObject", set the dialogue entry's Sequence field to:
2. Or connect to the method using an OnExecute() scene event.
1. Use the SendMessage() sequencer command. Assuming customMethod() is on a GameObject named "My GameObject", set the dialogue entry's Sequence field to:
Code: Select all
SendMessage(customMethod, http://www.google.com, My GameObject)
2. Or connect to the method using an OnExecute() scene event.