DrawMeshInstanced vs RenderMeshInstanced

I recently used DrawMeshInstanced for an effect and saw some posts about RenderMeshInstanced. I have not been able to find what the differences are between the two. It seems RenderMeshInstanced is newer, should I be using it? Is it more performant for some reason?

I’ll have to run some tests myself, but any info on the DrawMesh vs RenderMesh apis and why to use one over the other would be great!

If you look at the Unity Docs, there really isnt any difference. Only difference is RenderMeshInstanced is a newer, you can use either or.

Sorry, I’m not entirely satisfied with the answer. It’s a fair question. I’d like to know that too.

Why was the additional method introduced? There must have been a reason.
If the only reason was passing the parameters differently, why didn’t they just use an overload?

The newer one accepts NativeArray, and is tidier keeping the params separately.

5 Likes

@georgerh , point is when you asked this question, we all went to the documentation and looked, and did some research, why didnt you?. We try and help, but cant be exactly on point all the time. There is so much info available out there between docs and google that its insane.

Trindenberg has the final answer, so if he found it, why couldnt you?. You seem like a smart guy, and even if support for NativeArray is the only difference, does that effect your workflow?. I dont mean to offend, honestly.

Also might be interesting to look through the Cs Reference repository on GitHub to see the C# code it uses (of it’s not internal)

Thanks All for the replys! Yes @Trindenberg seems to have found a great answer. To expand on this, I have not yet used the Jobs System. But after reading about it and NativeArray, I see that RenderMeshInstanced is more compatible with the new jobs system because it accepts NativeArray now. Think I might start digging into the Jobs system finally. I have yet to do any tests or do @DevDunk suggestion but id be curious to see if they did make any other tiny changes that push performance a little bit. Hopefully I’ll get a chance soon to do some.

Thank you @Trindenberg and @DevDunk for the polite responses.

2 Likes