【发布时间】:2017-07-21 21:47:00
【问题描述】:
我在 Unity3d 中使用 Moonsharp 时遇到问题。我正在尝试传递“AppletMessage”对象:
[MoonSharpUserData]
public class AppletMessage {
public string Name;
public string[] Args;
public AppletMessage(string _name, string[] _args) {
Name = _name;
Args = _args;
}
}
进入 lua 中的一个函数,我不知道该怎么做。 我目前正在做的是这样的:
//In a start function
UserData.RegisterType<AppletMessage>();
//Later on, after popping the latest message from a stack as 'LatestMessage'
result = applet.Call( applet.Globals["OnCatchMessage"],new AppletMessage[] {LatestMessage});
当它尝试调用函数并传入 AppletMessage 时,这给了我来自 applet 类的错误:
cannot access field of userdata<AppletMessage>
【问题讨论】:
标签: c# unity3d lua mono moonsharp