How to pass NativeHashMaps to ComponentSystem

How to pass NativeHashMap to [Job]ComponentSystems?

Can’t add a NHM to IComponentData, so can’t do normal inject.

Same forJobComponentSystems.
Once injected, I can pass to IJob struct from OnUpdate, but stuck injecting.

Here’s the gist showing where I’m at…TIA

What prevents you from storing it in the system?

I expect to read from this hashmap from multiple systems and monos.

If I store it on a system, I’m unsure how to access from other [Job]ComponentSystems or access from Monos.

To access it you can use

World.GetActiveSystem<YourSystem>().YourHashMap

To access it from the mono make sure you are getting the correct World.

1 Like