Page 1 of 1

GameObject as Lua parameter

Posted: Thu Nov 30, 2023 7:01 am
by danieltorok
Hello! I'm wondering if it would be possible to use (drag and drop) GameObject references to custom dialogue action/conditions? It would make it more robust and convenient to use.

Re: GameObject as Lua parameter

Posted: Thu Nov 30, 2023 8:50 am
by Tony Li
Hi,

You can drag-and-drop into Sequence fields (and even inject your own code to specify what to do when certain types of objects are dropped) but you can't do the same with the Conditions and Script fields. The Dialogue System's Lua is designed to be stable even if you export and import your database to text-based format, such as importing from articy:draft or exporting to Chat Mapper, so it can't have direct object references.

However, if you're not planning to export or import, or if you only need to reference GameObjects in scenes, you can use dialogue entries' OnExecute() UnityEvents (e.g., see Scene Events).

Re: GameObject as Lua parameter

Posted: Thu Nov 30, 2023 4:03 pm
by danieltorok
Hi! "OnExecute" actually works for my use case, I overlooked it first time. Thank you for helping me!

Re: GameObject as Lua parameter

Posted: Thu Nov 30, 2023 7:21 pm
by Tony Li
Happy to help!