Custom Lua function helper not showing in Editor UI

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

Custom Lua function helper not showing in Editor UI

Post by danieltorok »

Hello!

I wanted to add a custom Lua action as a state action, however If I choose Lua -> Custom, the custom helpers are not showing in the editor. The non-custom Lua options from the drop down are all showing their associated helpers.

Picture with non-custom Lua dropdown

Image

Picture with custom Lua dropdown

Image


Is this not supported for custom actions?
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Custom Lua function helper not showing in Editor UI

Post by Tony Li »

Hi,

Did you set up a Custom Lua Function Info asset?
danieltorok
Posts: 11
Joined: Tue Nov 28, 2023 9:36 am

Re: Custom Lua function helper not showing in Editor UI

Post by danieltorok »

Hello,

Yes I did, It is even working with Dialogue System. When I say the custom Lua functions not showing I'm talking about not just mine, but the integration custom functions like PlayMaker's FSMEvent etc. There is just an empty space.

If I did the setup for Dialogue System and it is working fine there, do I need additional setup if I want to use the same custom Lua functions in Quest Machine?
danieltorok
Posts: 11
Joined: Tue Nov 28, 2023 9:36 am

Re: Custom Lua function helper not showing in Editor UI

Post by danieltorok »

So I started to debug this. I noticed a significant code duplication in LuaScriptWizard.cs . There are two variants of the method DrawScriptItem, with seemingly the same content. One is called by Quest Machine the other by Dialogue System.

The Dialogue System variant uses EditorGUILayout.BeginHorizontal() and EndHorizontal(), the Quest Machine variant uses GUI.BeginGroup() and EndGroup().

I modified the function used by Quest Machine to look like the one used by Dialogue System and it is now working, only the placement is odd.

New screenshot after aligning the two functions:

Image
User avatar
Tony Li
Posts: 22104
Joined: Thu Jul 18, 2013 1:27 pm

Re: Custom Lua function helper not showing in Editor UI

Post by Tony Li »

I can confirm that Custom works with the Lua quest condition, but not the Lua quest action. I'll get this fixed in the next release.

In the meantime, you can get it working (but not as pretty) by commenting out these two lines in LuaScriptWizard.cs:
  • Line 1088: //GUI.BeginGroup(position);
  • Line 1148: //GUI.EndGroup();
The custom dropdown values will appear below the wizard section instead of in-line where they belong, but you'll be able to set them and click Apply.
danieltorok
Posts: 11
Joined: Tue Nov 28, 2023 9:36 am

Re: Custom Lua function helper not showing in Editor UI

Post by danieltorok »

Thank you!
Post Reply