Scene Event in Conversation Node

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
HunterTom
Posts: 18
Joined: Fri Dec 24, 2021 4:58 pm

Scene Event in Conversation Node

Post by HunterTom »

Hi,

I have been using the Scene Event in Conversation Node. I edit it directly in the inspector.

However, I found that certain functions wouldn't appear in the drop down list. (If the function takes more than two argument or even with single argument of type Vector3 for example) (I haven't figured out the patterns yet. If anyone has any idea that would be very much appreciated.)

How can I call the functions that wouldn't appear in the drop down menu during some certain conversation nodes?

Thank you very much!
User avatar
Tony Li
Posts: 22154
Joined: Thu Jul 18, 2013 1:27 pm

Re: Scene Event in Conversation Node

Post by Tony Li »

Hi,

This is a limitation of Unity's UnityEvents in the Unity editor. They only support up to one parameter and only primitive types (string, bool, float, etc.). Other UnityEvents such as UI Buttons' OnClick() events also have the same limitation.

If you need to call a function that takes more than one argument, register it with Lua. Then use it in the conversation node's Script field. (Tutorial)

Functions registered with Lua can also only take primitive types, but you could pass a Vector3 as its individual x, y, z values. Or provide the name of a GameObject and use GameObjectUtility.GameObjectHardFind(). This function is like GameObject.Find() except it can also find inactive objects.
Post Reply