- Home /
Prefabs - static batching duplicates of them?
I couldn't really sum up the question well enough in the title, but here it goes:
Let's just say, I have a model in a modeling program. It is made of several meshes, to complete it's appearance as an entire model. Many of these pieces are just copies. Now, I bring that model into Unity. The intention is to mark the pieces as static and batch them together. Now, I need to either
A. make at one of those pieces a prefab, delete the rest, recreate the missing parts by duplicating the prefab.
B. Batch every original mesh piece, each as a unique mesh.
Now here is why I ask this, thus, my actual question:
Will doing option A save space in the build, since Unity will now know these pieces are in fact the exact same things? If so, is it also beneficial in any other ways?
Thank you, I appreciate the help!
Answer by Joyrider · Aug 11, 2013 at 08:22 PM
Hmm, if your objects are identical, you may create one prefab and replace them by that prefab. Now the question really is:
When you look at the imported objects, do they all reference the same mesh? That is basically what you want to know.
If they all use the same mesh, you won't have much difference in te buildsize of your game by specifically transforming them into prefabs.
If they don't, doing your prefab manipulation might be a good idea, for your buildsize, but also for your runtime memory usage (only one mesh in memory).
As for the batching, it doesn't matter if it is the same mesh or not, or if it is a prefab or not, as long as they have the same material; Unity will batch them together in the static batching.
They don't reference the same. From what I gather from the docs, any models imported has all its meshes treated as unique. But yeah! Thanks for the reply, just what I was looking to hear! Thanks!
Could be, I use a custom importer, so my meshes are common to all that use the same ;) But, that's good to know!