I’m curious, because I’d know if there actually was a functionality, that could do that, because it seems to me I could avoid a lot of pains…
var translationMap = new NativeHashMap<Entity, Translation>(10, Allocator.TempJob);
var translationWriter = translationMap.AsParallelWriter();
var translationAccess = GetComponentDataFromEntity<Translation>(true);
var assignHandle = Entities.WithReadOnly(translationAccess).WithReadOnly(translationMap).ForEach(
(ref ShieldTile tile, ref PhysicsVelocity velocity, in Translation translation, in Entity entity) =>
{
[...]
if (!translationMap.TryGetValue(tile.targetEntity, out var targetTranslation))
{
targetTranslation = translationAccess[tile.targetEntity];
translationWriter.TryAdd(tile.targetEntity, targetTranslation);
}
[...]
Well the only thing I want is to store the values I got from translationAccess, bc I don’t want to call it for EVERY tile. Also, if a shieldable has enough Tiles I want it to be removed from the GetTilesCandidate list, which is seperate for every TileSpawner. The Issue here is, I don’t know when the Shieldables are full, how many Shieldables are touched by the Spawner and how many Tiles a spawner has ready. I could figure it out. but that would be way more pain to implement than hoping that there might be a read AND write List/HashMap
EDIT: Alright I think I get it. I really have to think differently. as those values are just being layed out sequentially and any change to that would corrupt the sequence. but damn, I know why people came up with OOP^^ because this is a PITA