[BurstCompile]
public class NewBehaviourScript : JobComponentSystem
{
[BurstCompile]
struct MyStruct : IJob
{
public FunctionPointer<FuncT> test;
public void Execute()
{
test.Invoke(1);
}
}
[BurstCompile]
[MonoPInvokeCallback(typeof(FuncT))]
public static void TestFunc(int i)
{
Debug.Log($"TestFunc:{i}");
}
public delegate void FuncT(int i);
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
FunctionPointer<FuncT> pointer = BurstCompiler.CompileFunctionPointer<FuncT>(TestFunc);
MyStruct myStruct = new MyStruct
{
test = pointer
};
return myStruct.Schedule(inputDeps);
}
}
I call myStruct.Schedule and use FunctionPointer to crash on Android