Reference types error when using Burst

Hey!

I have a system that has a NativeMultiHashMap and helper methods which use this map. (Some hash calculations and lookups in the hashmap then)

I want to access these methods in other systems but with the system being a class and a reference type I’m unable to use them for Burst.

Is there a workaround?

Thanks!

Burst can access static classes and extension methods fine.

If you have a collection of helper methods that need state, store it in a struct and build it in the job.

Ok, thanks. After writing I realized, yeah, I have to go back to use statics and parameters which I wanted to avoid because it’s getting complicated with parameters now I have 3 mapping hashmaps now.

So, there was nothing else for this? Function pointers will also not help it seems.

Good thing I read your comment again and I’ve put my 3 NativeMultiHashMaps in a struct now which solves the issue of the parameter list.
As internally a UnsafeMultiHashMap is used with just a pointer copying this seems very fast.

Thanks tertle! Took me quite a while to refactor this whole mess, now I have a solution that I’m quite happy with.

Yep this is the solution I was going to come suggest. Helper structs are really useful for grouping logic together with burst/jobs.