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 を渡そうとすると、アプレット クラスからこのエラーが発生します。
cannot access field of userdata<AppletMessage>