#'materialMeshInfo does not point to a valid mesh' Error When Creating Entities

1 messages · Page 1 of 1 (latest)

candid viper
#

Hey everyone, I’m running into an issue with Unity’s Entities Graphics package when trying to render entities.

I’m using Entities 1.0+ and creating a procedural icosahedron mesh in a SystemBase. The mesh and material appear to be registered successfully, but when I assign MaterialMeshInfo to entities, I get the following error:

materialMeshInfo does not point to a valid mesh

I'm new to this so if anybody can help out that would be great

sharp hare
#

there is nothing we can do to help you unless you post the code that is wrong

#

the error also appears to be before you assign / add the component?

candid viper
sharp hare
#

are you trying to use submeshes?

candid viper
#

First generate a mesh (icosahedron) and then do submeshes yes

sharp hare
#

you shouldn't be using RegisterMaterial/RegisterMesh

#

if you're using rendermesharray

#

it registers it for you

#

RegisterMaterial/RegisterMesh is useful for runtime generation if you aren't using submeshes because you can then avoid having to use RenderMeshArray

#

to avoid the shared component on your entities

#

MaterialMeshInfo.FromRenderMeshArrayIndices(materialIndexInRenderMeshArray, meshIndexInRenderMeshArray)
should be using this for the MaterialMeshInfo info

#

but yeah, if you're not using submeshes, just avoid rendermesharray and register yourself

candid viper
#

Thank you for the usefull comment. And what if I want to generate a shape and then do submeshes to it?

sharp hare
#

if you want create a submesh you have to use rendermesharrayatm