Dynamic batching?

As I understand it, Unity dynamically batches during run time. I have bullets being spawned randomly in the area; however, they are each using an individual draw call. I am cloning the object from the Resources folder every time that I spawn a new bullet. The object has a material on it, so each clone should have the same material and the object has a really small poly count, so that isn’t the problem. Do I actually have to do something to set up the batching process, or am I making some blatant mistake?

Thanks,

kieblera5

  1. ensure its always the same material not cloned material
  2. ensure they don’t use alpha cause alpha stuff is handled a bit different
  3. if it uses particle effects, don’t forget they won’t batch over multiple emitters

May I ask you to explain this? There is a material set to the object. This object then gets cloned to create multiple bullets, so does that make it a “cloned material”?

Thanks.

no, at least not unless you access it to modify something on it.

but you can easily check it at runtime in the editor by selecting bullets as they are in the world (pause on error + usage of debug.logerror after instantiating the bullet helps here) and checking if the material references go to the same place

They are all referring to the same place; however, the material on the original object says rocket-01-default (Material) and on the cloned bullets it has the material rocket-01-default (Instance) (Material). Does the fact that it refers to it as an instance mean anything?

Or maybe the statistics window is wrong? I just tried an empty scene. If I put two of the objects in the scene, I get one draw call and two batched. If I put three in the empty scene, then there is one draw call and five batched? However, as soon as I run the app in the editor, the batched number goes back to zero and the draw calls get re-updated to the number of objects in the scene.

Is this just a bug or is there something wrong with my objects that they would act like this?