GameObject as Lua parameter

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
danieltorok
Posts: 11
Joined: Tue Nov 28, 2023 9:36 am

GameObject as Lua parameter

Post 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.
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: GameObject as Lua parameter

Post 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).
danieltorok
Posts: 11
Joined: Tue Nov 28, 2023 9:36 am

Re: GameObject as Lua parameter

Post by danieltorok »

Hi! "OnExecute" actually works for my use case, I overlooked it first time. Thank you for helping me!
User avatar
Tony Li
Posts: 21679
Joined: Thu Jul 18, 2013 1:27 pm

Re: GameObject as Lua parameter

Post by Tony Li »

Happy to help!
Post Reply