Custom Lua Functions not showing

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
JuSt
Posts: 7
Joined: Wed Jul 13, 2022 6:49 pm

Custom Lua Functions not showing

Post by JuSt »

I found this thread which talks about a similar issue.

I have custom lua functions that work (if I add them in the script section manually), but don't show up in the custom script dropdown menu. For some reason, older custom functions do show up.

I'm currently using Unity 2020.3.36f1 and there are no errors showing up (unlike the linked thread above). I tried restarting unity, making a copy of the database, closing/reopening the dialogue editor window. The new custom functions simply don't show up.

These are the functions and only AddToJournal and ChangeJournalStatus (two functions that I added a while ago) will show up. The same problem exists for conditions.

Code: Select all

private void OnEnable()
        {
            // Scripts
            Lua.RegisterFunction("AddToJournal", this, SymbolExtensions.GetMethodInfo(() => AddToJournal(string.Empty)));
            Lua.RegisterFunction("ChangeJournalStatus", this, SymbolExtensions.GetMethodInfo(() => ChangeJournalStatus(string.Empty, (double)0)));
            Lua.RegisterFunction("TradingMenu", this, SymbolExtensions.GetMethodInfo(() => TradingMenu()));

            // Conditions
            Lua.RegisterFunction("CheckJournalEntry", this, SymbolExtensions.GetMethodInfo(() => CheckJournalEntry(string.Empty, false)));
            Lua.RegisterFunction("CheckJournalEntryStatus", this, SymbolExtensions.GetMethodInfo(() => CheckJournalEntryStatus(string.Empty, (double)0, false)));
        }
Do you have any suggestions what else I could try to see if I can get them to show in the dropdown menu?
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Custom Lua Functions not showing

Post by Tony Li »

Hi,

Are your new Lua functions defined in a CustomLuaFunctionInfo asset? Is there perhaps an issue with function names in that asset, such as the name being set to "/AddToJournal" instead of "AddToJournal"? (A slash without anything before it will confuse the Unity editor.) Are there any errors or warnings in the Console?
JuSt
Posts: 7
Joined: Wed Jul 13, 2022 6:49 pm

Re: Custom Lua Functions not showing

Post by JuSt »

Aaaah, silly me. That's the problem. I didn't update them there :roll: Sorry for that! It's all good now.
User avatar
Tony Li
Posts: 21975
Joined: Thu Jul 18, 2013 1:27 pm

Re: Custom Lua Functions not showing

Post by Tony Li »

No worries! Glad you got it straightened out.
Post Reply