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
1
Question by aliakbo · Oct 17, 2015 at 01:15 PM · uispriteoptimizationsprite packer

Unity sprite packer not reducing draw calls in the UI

Hey,

I've been trying to optimize our game's UI and I wanted to use Unity's built in sprite packer to make a UI atlas.

I can see the atlas being created in the sprite packer window but it has had no effect on the draw calls in the scene. The altas apparently has no effect on sprites used on sprite renderers. It seems like it is still using the separate sprites.

Am I missing something here or is there something generally wrong?

Thanks in advance, Ali

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Matheuz · Oct 17, 2015 at 04:42 PM

About the sprite field on the Sprite Renderer component, Unity abstracts the idea of Atlas and you don't see the renderer sprite's field linked to one (like NGUI used to). It is using the Atlas, but it hides it from you so it's more user friendly.

About the draw calls, overlapping UI elements need a new draw call, even if they are in the same atlas. So if you have a button been rendered in front of a panel and both live in the same atlas, one draw call is necessary for each, since the graphic card can't overlap 2 sprites with one draw call. It first draws the background, then the foreground.

EDIT: My last paragraph is wrong. It is possible to draw 2 UI elements that overlap each other on the same draw call, just like 2 3D objects that share the same material can be drawn on the same draw call even if one overlaps the other. Hence, the problem must be something else.

Comment
Add comment · Show 2 · 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 aliakbo · Oct 17, 2015 at 09:27 PM 0
Share

Thank you for your detailed answer. Creating my own atlas using a 3rd party atlas maker and using that, does actually reduce my draw calls to what I am expecting though.

avatar image Matheuz aliakbo · Oct 17, 2015 at 09:37 PM 0
Share

Interesting, I didn't have any problems with non-overlapping sprites and draw calls. I wonder what's happening. Sometimes using the Frame Debugger helped answering these tricky questions, give it a try.

avatar image
0

Answer by hippogames · Mar 30, 2016 at 01:16 PM

When using multiple atlases created by [Sprite Packer] there is strange issue when draw call count is more than atlas count. Maybe it is caused by overlapping. But it doesn't happens when using single atlas even if some sprites are overlapped.

To fix it just assign [Order in Layer] of [Sprite Renderer] according to atlas index. Or just assign incremental index for each separate sprite [1, 2, 3, 4...]. Both methods worked for me.

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

43 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unity's Sprite Packer or Manually Creating Atlas? 0 Answers

Sprite Alpha Performance 0 Answers

C# making an optimized UI 1 Answer

Sprite Packer also include original sprite in build 0 Answers

Inconsistent Sprite location on screen 1 Answer


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