@ - So I’ve worked out what the problem is. It turns out you cannot set a material on a mesh section if that mesh section either doesn’t exist already or is not created in the same tick.
My actors add an empty RMC to themselves in the constructor. No materials or mesh sections are set at this point. Later on as the game dictates for a given actor, a material needs to be set and a mesh section needs to be created. The problem is that these two conditions are not met in exactly the same tick. For example, the player may choose a material and then it takes a few ticks before the mesh section needs to be created.
So the problem was that I was setting a material into slot 0 on the RMC, but I’m guessing slot 0 doesn’t exist as there is no mesh section yet. However if I force it to create the mesh section in the same tick, then it works fine. Even if I set the material before creating the mesh section. This explains why it would fail the first time and then work each time after that as the mesh section was now created.
Unfortunately, I cannot set the material and create the mesh section in the same tick. So to get around the problem I need to create a dummy mesh section in the constructor, so the RMC is not empty. To do this, I’m just using three vertices all at the world origin so they effectively make an invisible triangle and then create a mesh section from that. This ensures that material slot 0 exists and I can then set the material when needed. Later on, when the real mesh section is created, it simply overwrites the three dummy vertices.
So, not an ideal solution, but I can’t think of any other way around this issue. I’m not sure if this is a bug with RMC or just a limitation?
I’m conquering the same issue. Unfortunately I’m not able to solve it they you were able to. It happens on my end after clearing and than creating the section + setting the material again. To solve it, I just made sure the create + set material is happing only once.