Any performance loss with prefabs?

 
Post new topic   Reply to topic    Unity Community Index // Unity Support
View previous topic :: View next topic  
Author Message
AustinJ



Joined: 10 Apr 2009
Posts: 4

PostPosted: Thu Nov 05, 2009 4:33 pm    Post subject: Reply with quote
Quick question about prefabs...

If i have a model of a box(one mesh) that needs to be duplicated about 600 times in unity, will I have better performance if I create a box prefab, then duplicate it? Or is it more or less the same as if I just import the model and duplicate it?

thanks
Back to top
View user's profile Send private message
oxl



Joined: 21 Nov 2008
Posts: 134

PostPosted: Sat Nov 07, 2009 2:19 am    Post subject: Reply with quote
I would like to know this , too.

Maybe this is not the perfect sub-forum to ask this question.

-
oxl
Back to top
View user's profile Send private message
dreamora



Joined: 05 Apr 2008
Posts: 6663
Location: Zürich, Switzerland

PostPosted: Sat Nov 07, 2009 9:04 am    Post subject: Reply with quote
it will in both cases be pretty heavy if they are on screen as its 600 distinct objects in both cases.

The main difference is that with your own you can layout the UVs on the cube as you need them while you have to use the one provided if you use the unity one (unsure if unity's cube has per side UVs or not)

_________________
Technologies: Unity Pro, iPhone Advanced
Site: GayaSoft & PatchLaunch Technology
My Blogs:My Development & Persistent Online Worlds
Back to top
View user's profile Send private message
Tzan



Joined: 05 Apr 2009
Posts: 26
Location: Boston, MA

PostPosted: Sat Nov 07, 2009 6:45 pm    Post subject: Reply with quote
600 objects will use 600 draw calls per light, assuming you used just 1 material per box.

If you are not moving these boxes around individually during play, you can use the Combine Children (CC) script to make 1 mesh out of them. Then its just 1 draw call.

number of different materials x lights = draw calls on a CombineChildren mesh

I think thats right.

If you need to move some you can get creative and group them, then remove CC do changes set CC back on.
Back to top
View user's profile Send private message
Post new topic   Reply to topic    Unity Community Index // Unity Support 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