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
0
Question by Robo648 · Jan 09, 2018 at 09:50 PM · spritebatchingatlas

Same Sprite in multiple sprite atlases breaks dynamic batching

I use the same sprite in two sprites atlases for dynamic batching in different situations, but unity always uses the same (first) atlas. Because of this dynamic batching breaks in the second scenario. I dont want to import the same sprite twice and all the sprites in the same atlas is too big. Does anyone have an idea how to achieve dynamic batching in both situations?


EDIT:

First I import the sprite sheet (smoke animation) and cut it with the sprite editor (different smoke states as separate sprites). Then I use the sprites in my scene. After that I create a sprite atlas and add all sprites of the scene that should be batched together (smoke sprites, cactus sprite and so on). This works without any problems.

In a different situation I also need the smoke animation. Because of that I create a new sprite atlas (cannot use the first one, because of the size) and add the smoke sprites with some other. But batching doesn't work here, because unity uses the wrong atlas for the smoke sprites: First the right atlas is chosen. Then unity switches the atlas because of the smoke sprites. After that unity uses the right atlas again.

I know that i could optimize the scene with a different order of the sprites. Nevertheless there is one extra draw call for the smoke animation.

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 Robo648 · Jan 11, 2018 at 09:51 AM

None have a solution? Is it possible to import the same image twice? I don't want to switch the sprite in multiple folders if something changes.

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
avatar image
0

Answer by creganjordan292 · Jan 11, 2018 at 10:05 AM

I'm unsure why you would want to waste texture memory by storing the same sprite twice, as an extra draw call doesn't really hurt much. Either way, the reason why dynamic is breaking is because you have two different sprite objects, with two different references. You need to switch between them (more overhead) when you switch sprite sheets.

Comment
Add comment · Show 14 · 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 Robo648 · Jan 11, 2018 at 10:41 AM 0
Share

Do you have an idea how to use the same sprite in two atlases? All visible objects are from the same atlas and just for one sprite unity changes the atlas (breaks batching), because the sprite is also in the second one. I don't understand why unity doesn't check if the current atlas also contains the sprite.

avatar image creganjordan292 Robo648 · Jan 11, 2018 at 10:56 AM 0
Share

Because the reference for the sprite is still pointing to the original atlas, you need to tell unity to use the other sprite, as it doesn't know it's the same sprite.

avatar image Robo648 creganjordan292 · Jan 11, 2018 at 11:23 AM 0
Share

How can i do that? Currently I put the sprite to the renderer and after that I add it to both atlases.

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

100 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 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 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

Batching to IOS not working ??? 0 Answers

U4.6 - How to use individual sprites from an atlas in script? 1 Answer

How to set Sprite Atlas Variants active ? 0 Answers

Sprite batching 1 Answer

Getting dynamic batching to work with 2D sprites? 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