Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by SovietSpartan · Dec 05, 2014 at 07:00 PM · spritebatchingtower-defense

Getting dynamic batching to work with 2D sprites?

Hello, i have been creating a 2D "tower defense" game for Android and i've added a turret that shoots a shell that blows up and creates 4 smaller shells. However, these small shells each create 1 draw call and i end up with about 400+ drawcalls when the player has a bunch of these turrets (and my game normally has around 70), even tho they have the same sprite, material and size and aren't affected by any kind of light (since my game doesn't use any kind of lighting).

I've been looking everywhere to find an answer but haven't found much on dynamic batching with 2D Sprites. Can anyone tell my why aren't my sprites batching even though they are identical to each other? and can also anyone tell me how does dynamic batching even work on Unity 2D?

Also, as another small question, i have a game that normally has about 40 - 70 draw calls for Android too, but it seems to be lagging a lot and the profiler says most of it is caused by the GUI.Repaint, however even when reducing the GUI it still lags. Anyone have an idea what other things could cause the lag?

Thanks for any help, in advance :)

Comment
Add comment · Show 1
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 Karuuva · Jun 02, 2015 at 08:09 PM 0
Share

Did you ever figure this out? If not, I have some questions:

  • Do the 4 little bombs use any sort of animation?

  • If so, are all the sprites for the animation in the same Graphic file?

  • Are you recoloring the bombs through code ($$anonymous$$G, renderer.material.color = new Color(colorR, colorG, colorB, alphaA);)

I'm making a defense style game as well, and just noticed that certain objects ARE batching and certain ones are NOT, and the key difference in my case appears to be if they're using graphics from different sprite sheets. Also if they're colored in script, that $$anonymous$$IGHT be breaking one of my objects, but I have more testing to do on that to deter$$anonymous$$e if that's the case.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by raiden · Jul 31, 2015 at 02:21 PM

A few rules to Dynamic Batching I've learned:

  1. Must be enabled in Player Settings

  2. 2D Sprites must have the same Packing Tag name

  3. 2D Sprites must use the same compression format in the Import Settings

I just ran across this issue in my 2D Game, I had 15 game sprites, these consisted of a sky background and dirt sprites. My top dirt sprites where actually the grass layer, which contained a small corner of alpha, thus giving it a different compression format (RGBA instead of RGB), which was creating the additional draw calls. Once I changed my compression format on the grass sprites to match all the other sprites, "poof" like magic, I reduced my draw calls!

Hope this helps out!

-Raiden

Comment
Add comment · 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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Is it possible to implement Batching directly? 1 Answer

Custom Sprite Renderer - Batching 0 Answers

Unity - Repack sprites at runtime 0 Answers

Is it possible to utilize iphone dynamic batching with "traditional" animated sprite techniques? 1 Answer

How UI Batching works with two different sprites ? 0 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