RenderMeshArray contains lot of nulls in Build

Not sure what it cause, but most of my RenderMeshArrays contained mesh and materials are null. I debugged a bit, the baker in the build seems adding it correct, but when i debug it they are not there anymore.

I used subscene conversion to create them. Any idea how this could happen?

The baking should not place any nulls in RenderMeshArray on purpose. Are you seeing nulls in the editor, or do the nulls only appear in the player?

Can you file a bug report with a repro project so we can investigate the issue?

Thanks for the fast response, its only in the build version. After a long try and error session i found the problem. What i did:
After loading the scene, i removed all scene tags from the entities and removed the scene, so i am in the state where only the entities of the scenes exists. After one frame all mesh and materials are null, i guess they are being destroyed from a cleanup?

In the Editor this worked perfect, but in the Build it looks like its destroying the Mesh and Materials.

In Editor: It worked
With Entities 0.5 where i updated from: It worked
After build: They are null

Here the code i used directly after the scenes finished loading:

EntityManager.RemoveComponent<SceneSection>(new EntityQueryBuilder(Allocator.Temp).WithAll<SceneTag>().WithOptions(EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabledEntities).Build(EntityManager));            EntityManager.RemoveComponent<SceneTag>(new EntityQueryBuilder(Allocator.Temp).WithAll<SceneTag>().WithOptions(EntityQueryOptions.IncludePrefab | EntityQueryOptions.IncludeDisabledEntities).Build(EntityManager));
SceneSystem.UnloadScene(EntityManager.World.Unmanaged, sceneEntity, SceneSystem.UnloadParameters.DestroyMetaEntities);

It’s possible that doing that somehow triggers unloading the meshes and materials, since in the player those are also loaded when the subscene is loaded. I would suggest leaving the scene related things as is, unless you are explicitly trying to unload the scene (in which case the entities should also disappear)

1 Like