• 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 Stephane-Imbert · Mar 10, 2015 at 02:45 PM · unity 5uiassetbundlessprite packersprite sheets

New asset bundles variants (5) and Unity UI spritePacker

Hi all,

We are working on a mobile game (iOS/Android) using Unity 5 and Unity UI.

What we want to do is the following:

  • have 2 sets of UI textures for different screen resolutions (low-res/high-res)

  • pack all UI textures within a single set into an atlas using the Unity SpritePacker (so one low-res atlas and one high-res atlas)

  • pack the atlases into an assetbundle to be downloaded at runtime based on the device (so there is only one of the low-res/high-res atlases on device when running)

  • have prefabs in the app (not in an asset bundle) that reference the correct sprite from the atlas in the asset bundle

The reason why we are doing that is to (a) get pixel perfects icons in all resolution and (b) use only as much memory as is strictly necessary for that resolution.

I am looking at the new assetBundle variants and the spritePacker as a way to do that. There is no documentation specifically on that workflow and I have a few questions based on what I am seeing so far.

First:

I cannot use the CanvasScaler because this means either (a) high-res assets scaled down on low-res devices (too much memory on low-res devices) or (b) low-res assets scaled up on high-res devices (which means scaling artifacts)

Second:

To create a sprite atlas, I need to specify the name of the atlas in Packing Tag for that specific sprite. However, if I use the same name for my low-res and high-res folders, all the resolutions end up packed in the same atlas, which is not what I want as low-res devices will end up with a gigantic atlas containing high-res assets (and these devices tend to be lower on memory).

If I provide different names for the atlases, my understanding is that assetBundles variants will not work as the variants are supposed to be "identical" (which I understand to mean, the assets need to have the same names and sub-folders, but not the same root folder, for instance low-res/folder/a.png and high-res/folder/a.png)

Third:

I cannot work around the asset bundle creation if I want to use the new asset bundle pipeline (which I do) because (a) the documentation indicates that mixing the two is a bad idea and (b) I need the new system for the myriad other resolution-specific assets we need to download for the game.

I am curious if this is a tested scenario for Unity 5 and if there is a recommended solution to meet the goals above.

Variants and atlases don't seem like they can work together, the documentation for multi-resolution UI only deals with layout and anchoring, not image substitution which is needed for pixel perfect icons on all resolutions, and finally the demo scene for asset bundle variants shows how to swap materials referenced in a scene and doesn't deal with atlases.

Thanks,

Stephane

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 Ramphic · Apr 06, 2018 at 03:40 PM 0
Share

Did u find any work arounds for this ?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by kbhatt · Apr 13, 2015 at 04:55 PM

http://docs.unity3d.com/Manual/BuildingAssetBundles5x.html This doc shows how to create identical variants in Unity5

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Failed to convert sprite texture type in unity UI 0 Answers

Unity 2D Sprite Packer and Packing tags taking effect immediately after setting up? 1 Answer

Making a dynamic radar type graph 3 Answers

Loading a scene after a random amount of time. 1 Answer

Need help with creating UI Text 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