Does using prefabs help with resource optimization?

Hi,

I modeled a bunch of rocks in Blender. I have been dragging and duplicating them into my terrain, resizing and adding textures as I go to suit the scene. My question is, would it be better from a resource standpoint, to make a set of prefabs and use them instead of dragging the rocks directly from Blender? In other words, should I go back and make small, medium and large rock prefabs, each with a choice of textures and then drag from those prefabs into the terrain? Would this optimize resources at all or not make any difference? Thanks.

Zaffer

Yes unity prefers this approach as it can cull them and it takes less memory, and scenes load faster. It is a good idea if the rocks share the same material and texture (it is ok if they are separate meshes) so that it can internally optimise more.

Thanks Hippocoder. I was afraid of that. Oh well, back to the drawing board!

Zaffer

Well most games are set up like this these days, pretty much any unreal engine game is, and any crysis game too. Prefabs = plenty of engine optimisation potential.

You should consider just adding a script that scatters instantiated rocks of all sizes around based on a greyscale map. The engine just raycasts down per rock with random rotation and so on… you can even do this as an editor process, so you can lightmap them (editor tool). Plenty of options.

If possible, try to make all the rocks a single mesh, as this would go even further to optimize the number of draw calls, etc.

1 Like