Search Unity

NativeMultiHashMap updates

Discussion in 'Data Oriented Technology Stack' started by kaffiene, Oct 9, 2018.

  1. kaffiene

    kaffiene

    Joined:
    May 26, 2013
    Posts:
    21
    I'm using a NativeMultiHashMap for Spatial Hashing. When I move objects, I need to update the map - which involves reading the existing values via a NativeMultiHashMapIterator, removing the value using that iterator and then adding the value again against a new hash value key.

    I'm just wondering about how to schedule this efficiently. Only the additions can be done concurrently using NativeMultiHashMap.concurrent, so presumably I need a job for reads/removals followed by a parallel job for additions? How would that look? Do I have two jobs in a System (or can a system only have one job?) or should this be multiple systems? Sorry - this is probably basic stuff but I can't figure out how this should look.

    Thanks for any help!
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,671
    Two jobs in a system with the second job having a dependency on the first sounds pretty reasonable.