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!
Scene Event in Conversation Node
Re: Scene Event in Conversation Node
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.
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.