I’m currently creating a system that needs to call one of 100+ functions on some data. At the moment, everything is set up in an IJobChunk, I put all the relevant data from Components into NativeArrays, and passing said NativeArrays by ref, invoke a FunctionPointer that I set on creation of the Job struct using Marshal.GetFunctionPointerForDelegate. However, it seems like the resulting IntPtr points to the non-Burst version of the relevant function, as in addition to a huge (20x) performance hit, I’m able to inspect it with Deep Profiling, whereas when I directly call the same function instead of using the FunctionPointer, the Job struct’s only child in the Profiler’s hierarchy is JobAlloc.Grow.
So my question is, how do I get a FunctionPointer to point to a Burst-compiled function?
Alternatively if that’s not possible, would there be a way of invoking one of 100 or so Burst-compiled functions without creating a monolithic if-statement binary-tree?