- Home /
when I using ECS ,EntityManager.SetSharedComponentData report "hashmap is full"
I creating a 3d city in unity3d with ECS it have so many diff building mesh(160K+) when I run my code like:
Entity entity = em.Instantiate(src);
RenderMesh renderMesh = new RenderMesh()
{
mesh = m,
material = mat,
castShadows = ShadowCastingMode.Off,
receiveShadows = false,
};
em.SetSharedComponentData<RenderMesh>(entity, renderMesh);
I get err msg : "HashMap is full" and unity cash.
But I try to creat less buildings(<10K) , the code run success.
is NativeMultiHashMap had a bug?
"hash is full" is throw by NativeHash$$anonymous$$apBase.AllocEntry. so the question is: - can I set bigger NativeHash$$anonymous$$ap size in SharedComponentData$$anonymous$$anager? - how can I creat big count different mesh in ECS? - why unity cash?
Answer by andrew-lukasik · May 20, 2020 at 08:14 PM
I came across few hard limitation like this one myself and my solution to these so far is to just spin more World instances to accommodate them. If one starts thinking about Worlds as buckets of data and related processes (systems) this even starts makes more sense to organize everything this way.
Also if I understand it correctly these aren't limitations per se but decently wise optimization. Because while every World preallocates memory to speed up processes:
it cannot preallocate infinite/all memory (shocker I know)
dynamic allocations would be bad for performance
Both alternatives would defeat whole point of ECS so arbitrary buffer lengths had to be choosen here and there.
Your answer
Follow this Question
Related Questions
Unity isn't reading the mesh I created 1 Answer
Understanding an error message. 1 Answer
how do i fix this error 2 Answers
Failed to clean mesh???? 1 Answer