I tried to implement bark system, but i'm getting an error. At first it worked great! The tutorial is good. But I did something that broke.
I can assure you that the function is registered. I changed the debug level to information and it appears there.
I'm getting some errors message, but I can't figure out what should be. Can you help me, please?
Code: Select all
Dialogue System: Lua code 'return GetEnemyRace() == "Wolf"' threw exception 'Tried to invoke a function call on a non-function value. If you're calling a function, is it registered with Lua?'
UnityEngine.Debug:LogError (object)
Below are the codes that I made.
Code: Select all
#region Lua
public string GetEnemyRace()
{
Debug.Log("enemy.enemyRace.ToString() " + enemy.enemyRace.ToString());
return enemy.enemyRace.ToString();
}
void OnEnable()
{
Lua.RegisterFunction(nameof(GetEnemyRace), this, SymbolExtensions.GetMethodInfo(() => GetEnemyRace()));
}
void OnDisable()
{
Lua.UnregisterFunction(nameof(GetEnemyRace));
}
#endregion
Thanks!!