Unity Batching Instantiated Prefabs

In my game I have a prefab that display creature information, such as health and status effects. To create my images I often have hierarchically layered images, but as they are the same in across all the spawned prefabs, I’d like them to be batched. My prefabs look something like this.

gameObject → background → healthVialBackground (mask) → health → healthVialOutlie
→ nameShadow → nameTextured

All the images are set with the same package name, the same compression format and are on the one atlas. Each differently named image is a separate material, though the materials are consistent across all the instantiated prefabs. I would like these prefabs to batch draw, as they can all draw background at the same time, at the same scale, followed by the rest of the tree in order.

What am I missing here? I have googled and googled and it all seems particularly unclear.

Believe it or not, you are actually quite limited in this area on what you can do.

Unity does have Dynamic batching, but as far as I’m aware, it is a hit or miss kind of thing, it either works or it don’t. E.G. - Attempts to do it.

Now Static Batching, you could do, but then you’d be faced with not being able to move the said object at all. So wherever it instantiates, is where it will stay, but will batch. But it won’t follow anything. It will just stay where it created at until you destroy it.

Now, one more thing that I can think of, but it may require creating a special shader, but you can find out about GPU Instancing. I know the Standard Shader has this, so perhaps you can get it into a UI Shader perhaps.

But keep in mind, you don’t ‘batch’ ‘Prefabs’, you batch Materials. Unity will try it’s best to batch dynamic objects (if it’s enabled), but it is not guaranteed to batch. The only guaranteed way to do it is to do Static Batching. But then you deal with the limits of Static Batching .

To do static batching make sure it’s enabled first of all (Think it is by default).
Then in the prefab at the top right where it says “Static” click the little down arrow next to it then click “Static Batching”.

Then it should just work.