Vertex colors not visible on primitive models

I think I see what the problem is. Mesh Instance caches some information about the mesh … such as info about vertex format. When you change the vertex format of the mesh, the mesh instance data is not updated to match.

What I would suggest to do:

  1. use render component, instead of model component, to create your cube.
  2. get mesh instance from render component, get mesh from it … and modify it as you do at the moment. also keep a material that mesh instance uses.
  3. create new mesh instances and assign them to render component. something like
    this.entity.render.meshInstances = [new MeshInstance(mesh, material)];
2 Likes