#Error while using NativeParallelMultiHashMap

1 messages · Page 1 of 1 (latest)

alpine remnant
#

I'm attempting to make a physics resolution system for a 2D game made in Unity 6 ECS and am using a NativeParallelMultiHashMap in order to have all entities sorted into lists for use during manifest generation and resolution. I'm only starting to implement the system however with just bare-bones code it will throw the error ObjectDisposedException: The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it even with just this code:

public void OnUpdate(ref SystemState state)
{
    NativeParallelMultiHashMap<uint, Entity> entbyfloor = new NativeParallelMultiHashMap<uint, Entity>();

    foreach (var (gps, entity) in SystemAPI.Query<RefRO<GPS>>().WithEntityAccess())
    { entbyfloor.Add(gps.ValueRO.FloorID, entity); }

    if (entbyfloor.IsCreated) entbyfloor.Dispose();
}

What is this error, what does it mean, and what can I do to fix it, I'm not even sure where to begin. Based on what I read online the if (entbyfloor.IsCreated) should've fixed it, but the error persists.

harsh osprey
#

you haven't allocated it

#

use the actual construactor

alpine remnant
#

Huh, I feel like I tried that, it did work, thanks. What does capacity imply by the way? Total values period, values per key?