Page 1 of 1

Custom Lua Functions not showing

Posted: Thu Jul 14, 2022 9:25 am
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?

Re: Custom Lua Functions not showing

Posted: Thu Jul 14, 2022 9:41 am
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?

Re: Custom Lua Functions not showing

Posted: Thu Jul 14, 2022 10:23 am
by JuSt
Aaaah, silly me. That's the problem. I didn't update them there :roll: Sorry for that! It's all good now.

Re: Custom Lua Functions not showing

Posted: Thu Jul 14, 2022 1:29 pm
by Tony Li
No worries! Glad you got it straightened out.