GameObject as Lua parameter
-
- Posts: 11
- Joined: Tue Nov 28, 2023 9:36 am
GameObject as Lua parameter
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
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).
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).
-
- Posts: 11
- Joined: Tue Nov 28, 2023 9:36 am
Re: GameObject as Lua parameter
Hi! "OnExecute" actually works for my use case, I overlooked it first time. Thank you for helping me!
Re: GameObject as Lua parameter
Happy to help!