[To marshal a manged method,please add an attribute named "MonoPInvokeCallback’ to the method definition.]
When I add this
[MonoPInvokeCallback(typeof(GotyeCallback))]
static void Test(int event_code, IntPtr args){}
build error:
[Assets/TEST1.cs(1018,18): error CS0246: The type or namespace name `MonoPInvokeCallback’ could not be found. Are you missing a using directive or an assembly reference?]
Unfortunately the whole MonoPInvokeCallback thing is a bit of a hack to make calls like this work with an AOT compiler. You can poke around on Google for the long and sordid story if you would like to.
The short answer is that you need to implement the MonoPInvokeCallbackAttribute in your code somewhere. You can use this implementation:
public class MonoPInvokeCallbackAttribute : System.Attribute
{
private Type type;
public MonoPInvokeCallbackAttribute( Type t ) { type = t; }
}