NativeHasMap.GetKeyArray in job [alternatives]?

NativeHasMap.GetKeyArray returns a NativeArray which later has to be disposed if used inside Execute within a job. Disposing of a container in a job is a feature coming up in 2019.1. Any suggestions/workarounds meanwhile for getting keys in a job for hashmap iteration without disposing a nativecontainer? Thank you.

wait. maybe I should just try 2019.1 alpha : ) ?

1 Like

I was about to remove this from my library as I thought it wasn’t required anymore but maybe there is still a use for it.
https://discussions.unity.com/t/728163/9
Doesn’t return keys but returns an iterator for all key/value pairs so you could just use the key part if that’s all you care about. Does not create a native container or produce any allocations.

1 Like