Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Squeegy · Apr 27, 2010 at 02:45 AM · performanceparticlesdrawcallsbullets

Draw call reduction for a stream of bullets

I'm noticing that when I hold down the fire key, my rapid fire machine gun causes the draw calls to go from 12 to 94. Each bullet is an instantiated prefab right now with a Projectile script on it that handle collision behavior, hold damage variables, etc.

Ideally, since I'm cloning a prefab with an identical material, my draw calls should go from 12 to 13 when I hold the fire button.

Should I create a global ParticleEmitter for each projectile type that compiles it all in single draw call for me? That seems crazy and I would love the ability to still tweak game values on individual projectiles if I need to.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Eric5h5 · Apr 27, 2010 at 04:23 AM

Every individual object is at least one draw call whether it shares a material or not. (Except on Unity iPhone, with some restrictions, but even that has overhead compared to one real draw call to begin with.) Generally speaking, for a rapid-fire gun, you wouldn't really generate hundreds of individual objects, because that's a lot of resources to devote to something you don't even see in a lot of detail. Instead you do a raycast or similar, and make an effect that simulates lots of bullets, such as (indeed) a particle system.

Comment
Add comment · Show 7 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image The-Oddler · Jan 03, 2013 at 12:15 PM 0
Share

This is nor really true. If your objects share material (and with some more restrictions: http://docs.unity3d.com/Documentation/$$anonymous$$anual/DrawCallBatching.html) they should all go in a single draw call. Though the physics on a whole lot of bullets is very heavy, so doing a raycast is still a better idea.

avatar image Eric5h5 · Jan 03, 2013 at 03:30 PM 0
Share

It was true in 2010, when I answered.... Actually it's still true that making lots of separate bullets is not the best idea, even with dynamic batching (which still has overhead, and sometimes doesn't result in any real performance gain anyway).

avatar image The-Oddler · Jan 03, 2013 at 05:41 PM 0
Share

It's true it's not a good idea, the raycast is the better idea, though in my experience dynamic batching gives a considerable performance gain (with thousands of objects, running at 60fps and 30 on ios (ios is capped at 30))

avatar image Eric5h5 · Jan 03, 2013 at 06:21 PM 0
Share

iOS isn't capped at 30; you can use Application.targetFrameRate = 60 (which it is capped at, since the screen has a 60Hz refresh rate with vsync forced on).

avatar image The-Oddler · Jan 03, 2013 at 06:29 PM 0
Share

Weird, then why does xcode shows maximum of 30fps? (in any project, even when there's nothing)

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Is there anyway to get Unity GUI to cache an image? 1 Answer

Beast lightmapping and draw calls 1 Answer

How does the iPhone handle draw calls? 1 Answer

Dynamic Batching, Combine Meshes? 1 Answer

what's the best way to reduce draw calls? 9 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges