Does instantiating increase draw calls?

As far as I am aware, if you have a bunch of objects that use the same material, they should combined all only require one draw call, right?

So I have 100 identical objects being cloned from an object and I am getting a draw call for each clone! Is this normal? How would I fix this? My frame rates are okay but could do with optimisation.

Cheers :smiley:

EDIT: Here’s my code:

function InitialiseRoad()
{
	for (var i = 0; i < RoadArray.Length; ++i)
	{
		var j = (i - 1);
		
		RoadArray *= new RoadSegment();	// Add instances of custom class RoadSegment to array	*

_ RoadArray*.Sprite = Instantiate(RoadGraphic, Vector3.zero, Quaternion.identity); // Set the sprite part of roadSegment*_
RoadArray*.Sprite.name = (“RoadSegment_” + i); // Set the name of the sprite*

* if (i >= 1)*
* {*
_ RoadArray*.Sprite.transform.position.y = RoadArray[j].Sprite.transform.position.y + fRoadSegmentOffsetY; // Move each segment up the Y*
RoadArray*.Sprite.transform.position.z = RoadArray[j].Sprite.transform.position.z - fRoadSegmentOffsetZ; // Move each back along the Z*
RoadArray*.Sprite.transform.localScale.x = (RoadArray[j].Sprite.transform.localScale.x - fRoadSegmentSizeDecreaseX);
}*_

* // Set texture offset for each segment*
_ RoadArray*.Sprite.renderer.material.mainTextureOffset.y = fTextureOffset;*_

* fTextureOffset -= 0.01;*
* }*
}

According to the documentation

  • There are limitations on the number of vertexes for dynamic batching
  • Using scaling will prevent batching
  • Different material instances will prevent batching
  • And so on…

Also, static batching is only available with Unity Pro.