- Home /
What does mesh.MarkDynamic actually do? Documentation explains nothing.
I've searched around and could not find an explanation as to what MarkDynamic actually does. Just vague information on when to use it.
I need to know exactly what it does so I can best optimize mesh generation in my game.
What effects does this have on memory? Does it change how the mesh.vertices, mesh.uv, mesh.triangles, etc behave when being accessed?
What if I only update a mesh every minute or two and I generate and store the vertices in my own code instead of reading them from the mesh itself?
What does it do?
I believe it's for performance reasons. If an object is not dynamic Unity can do some caching, but caching can take resources and time, so every time you move something that is not dynamic would cause a performance hit. So for example, a building is not dynamic, but a flag blowing in the wind would be.
$$anonymous$$y goal is to make mesh generation go as fast as possible. I'm willing to sacrifice memory far more than cpu cycles. So I need to know exactly what $$anonymous$$arkDynamic does.
The documentation says -> Optimize mesh for frequent updates. What internally this does I'm not sure, it maybe disables mesh compression, or keeps the mesh data in internal memory ins$$anonymous$$d of gpu memory etc. One idea is just to knock up a simple demo that generates a big mesh with thousands of vertices / faces etc. And see what setting works best for mesh building.
Friend, perhaps your intentions are good, but you're not addressing my question at all. I don't need someone to read the documentation for me (as you can see by the title), and I don't need speculation either.
I need to know what is going on under the covers. What effects it has. Otherwise I and anyone using this function are just making wild assumptions.
I was unable to deter$$anonymous$$e, using the profiler and other benchmarking, that $$anonymous$$arkDynamic actually improves performance in any measurable way.
Answer by Owen-Reynolds · Oct 15, 2014 at 11:49 PM
Traditionally, poorly documented optimization switches often do nothing. Just forever un-implemented placeholders.
And until Unity allows direct creation of tri and quad strips (fully specify each tri? That's for zoo gorillas who can't paint,) I'm not expecting great things from the Mesh class.
Amen to that. What a massive waste of RA$$anonymous$$ and CPU cycles (spent copying) the triangle array is. The $$anonymous$$esh class seems ill-suited for scalable modification.