Draw calls & prefabs

 
Post new topic   Reply to topic    Unity Community Index // Scripting
View previous topic :: View next topic  
Author Message
DavidT



Joined: 12 Oct 2009
Posts: 14
Location: Adelaide, SA

PostPosted: Thu Nov 05, 2009 10:55 pm    Post subject: Draw calls & prefabs Reply with quote
My paranoia tells me to keep draw calls down wherever possible. I noticed that as I instantiate multiple copies of the same prefab in code, my draw calls go up (typically by 2 for each new object due to the shader I'm using).

So, if I have a Gauntlet or Robotron style game where I'm spawining lots of objects from the same prefab, how do I keep my draw calls down to a reasonable number?
Back to top
View user's profile Send private message
tonyd



Joined: 02 Jun 2009
Posts: 308
Location: USA

PostPosted: Fri Nov 06, 2009 12:38 pm    Post subject: Reply with quote
If your objects share the same material, dynamic batching should reduce their draw calls down to 1 (or 2, in your case).
_________________
Froggy Math
http://www.mindspring.com/~torajima/meganesoft
Back to top
View user's profile Send private message Visit poster's website
steddyman



Joined: 10 Apr 2009
Posts: 144
Location: UK

PostPosted: Sat Nov 07, 2009 11:53 am    Post subject: Reply with quote
This is only true if your meshes contain less than 300 verts That is the maximum number of verts that dynamic batching operates on.
_________________
Ascii Studios
Blog: www.asciistudios.com
Twitter Web: http://twitter.com/asciistudios
Twitter ID: @asciistudios
Back to top
View user's profile Send private message Visit poster's website
Eric5h5



Joined: 19 Jul 2006
Posts: 6930

PostPosted: Sat Nov 07, 2009 12:14 pm    Post subject: Reply with quote
Since this isn't posted in the iPhone section, I'd assume the question is about Unity, which has no dynamic batching.

--Eric
Back to top
View user's profile Send private message Visit poster's website
DavidT



Joined: 12 Oct 2009
Posts: 14
Location: Adelaide, SA

PostPosted: Sun Nov 08, 2009 11:12 pm    Post subject: Reply with quote
Eric you're correct. Although I'll eventually be targeting iPhone, I'm getting up to speed with regular Unity first. So this question is for regular Unity.

I'm still unsure what to do if I want to instantiate lots of low poly (think cubes) objects from within code and keep my draw calls down to something sensible.
Back to top
View user's profile Send private message
Post new topic   Reply to topic    Unity Community Index // Scripting All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum