Why does it use 2 draw calls (I did my research, see thread)

SOLUTION
Wow ***, Plane 2’s scale was something like 1.345353 weirdness on the x and y, when I changed that to 1 like Plane 1 and Plane 3 the 2 it batched fine, got this cleared up, did not know that scale affected draw calls.
END SOLUTION

Hey Guys!

Ik have been digging around in a model of mine, its fairly simple but still I am trying to figure out why it is using 2 draw calls. (I currently have 20 draw calls in my scene, when I turn the object i’m talking about off along with it’s children the draw calls go to 18.)

I use no lights in my scene.

It is a plane with an image, so no 3d mesh is present.

Object Structure:
Object → One script attached
Object/Object (Child) → mesh filter, mesh renderer with material “Material1”, animation with 1 animation.
Object/Object/Object1 (Child) → mesh filter, mesh renderer with material “Material1”.
Object/Object/Object2 (Child) → mesh filter, mesh renderer with material “Material1”.
Object/Object/Object3 (Child) → mesh filter, mesh renderer with material “Material1”.

As you see I only use one material on each object. The shader I use is: (it was written by Mathieu http://forum.unity3d.com/threads/15414-Fastest-shader-for-iPhone?p=123734&viewfull=1#post123734)

Shader "_SimplestTransShader" {
	Properties {
		_Color ("Main Color", Color) = (1,1,1,1)
		_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
	}
	Category {
		ZWrite Off
		Alphatest Greater 0
		Tags {Queue=Transparent}
		Blend SrcAlpha OneMinusSrcAlpha
		
		SubShader {
			Pass {
				Lighting Off
				SetTexture [_MainTex]
				{
					constantColor [_Color]
					Combine texture * constant, texture * constant
				}
			}
		}
	}
}

The texture used in that material is a 1024x512 RBGA 32bit texture
Bilinear filtering
advanced texture type
no mip maps
no normal map

override for iPhone
max size is 1024
texture format is RGBA 32 Bit

I really hope someone can explain to me why I have these 2 draw calls. Hope I made everything clear haha!
Thank you so much guys!

ps: what effect does the “static” checkbox has in Unity 3 iPhone Basic? Thank you!

You say the object you observed to generate two unexplainable draw calls has a child object (or objects). can you elaborate on that?

Just a quick note, there may not be any 3D meshes on that object, but using the plane (and I’m assuming that you’re using the default Unity Plane gameobject) still generates 200 or so triangles… not that it should cause those extra draw calls. just saying ;D)

The “static” checkbox is there so you can set an object to act like an “occluder” in occlusion culling. Basically you only wanna set that on objects that do not move in your scene in any way. I hear there’s a lot of performance gain when it’s used properly.

and, oh yeah, have you tried setting a different shader for that object? i.e. the default ones like VertexLit

Quick note: The ‘static’ box is also used for the beast lightmapper

Thank you guys for clearing up the “static” question.

Yeah sure, hope this makes it clear.
It is an object made in 3DS Max with 3 planes. (2 tri’s per plane, so 6 tri’s.)
Each plane is UVW Unwrapped, and is using the same texture.
The plane’s are animated without bones. (Just a bit moving left and right)

I then exported it to a .FBX and imported it in Unity.
If you put it in the scene just like how it imported it’s hierarchy is:
Object (The parent, holding the planes together. Does not have any mesh itself.)
Object → Plane 1 (Child of Object.)
Object → Plane 2 (Child of Object.)
Object → Plane 3 (Child of Object.)
All child’s use the same material and texture.
I then placed the whole thing in an empty GameObject (So the Object became a child of the empty game object, along with the 3 plane’s still the child’s of the Object.) so that I had an easy way to attach scripts and animation stuff going on.

Thanks for telling :slight_smile: Already found it out and made myself a plane in 3DS Max.

EDIT: Weird, I’ve been playing with it a bit more and it turn out Plane 1 and Plane 3 batch fine, but the Plane 2 is the thing causing 2 draw calls.

Plane 2 is just another plane like Plane 1 and Plane 3, using a Mesh Filter and Mesh Renderer with the same material as the other one’s.
Anyone knows what the cause of this could be as I am very suppressed that the other plane’s batch fine and this single plane counts for 2 draw calls.

EDIT2: Wow ***, Plane 2’s scale was something like 1.345353 weirdness on the x and y, when I changed that to 1 like Plane 1 and Plane 3 the 2 it batched fine, got this cleared up, did not know that scale affected draw calls.

Thank you for the help guys!

Nice to know you’ve solved your problem red, and thanks for sharing the solution.