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
2
Question by bmahloch · Jun 10, 2010 at 03:03 PM · iphonegraphicsipadspritemanager2

SpriteManager2 and Universal Apps

Is anyone using SpriteManager2 with a universal app (iPad/iPhone)? If so, how are you supporting multiple texture assets optimized for each device?

I was thinking I could create two prefabs (one using the iPad texture, one for the iPhone texture). Attach both prefabs to my GameManager script. For example "BackgroundPrefabiPad" and "BackgroundPrefabiPhone". Expose a single property on the GameManager called "Background" and return either the "BackgroundPrefabiPad" or "BackgroundPrefabiPhone" depending on the device. So when I instantiate the background its something like...

MonoBehaviour.Instantiate(GameManager.Background, [position], [rotation])

Would this make sense? My concern would be a ballooned file size on the .app because both prefabs are technically being used, granted at runtime only 1 of the materials would be loaded. Is their any "native" way of supporting this?

Thanks!

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
1

Answer by Tetrad · Jun 10, 2010 at 03:27 PM

I would suggest investigating using two different scenes that are basically clones of each other with different materials depending on if it's the high res or low res scene, and having an initial loading scene decide which of your two near-duplicate scenes to load depending on the user's device.

Maintenance will probably be a pain, though.

Comment
Add comment · Show 4 · 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 bmahloch · Jun 10, 2010 at 03:38 PM 0
Share

Interesting thought. Thinking about it...

avatar image defmech · Jul 12, 2010 at 05:25 PM 0
Share

I've been thinking about this same thing recently. All of my assets are big enough for any platform, it would just be a matter of choosing a different import option. However, I don't think you can select per-prefab texture resolution settings. I can't make a unique iPhone and iPad prefab that reference the same texture asset, but at different resolution. Duplicating the source asset to get around this kills the entire idea of Unity's asset pipeline and would make upkeep hell and that's all before any sort of scene implementation.

avatar image defmech · Jul 12, 2010 at 06:25 PM 0
Share

Spoke a little too soon, I guess. I went and checked the Texture2D class, which has functions for resizing/packing/compressing/etc texture assets at runtime. Detect device and resize as appropriate and you're set for materials. For GUI, you could do the same check and initialize different scripts or stick to proportional layout.

avatar image bmahloch · Jul 20, 2010 at 02:00 PM 0
Share

I ended up creating two versions of the scene. All my render logic is in script/code so maintenance is fairly easy. I just load with a SceneSelector.cs script which redirects to the correct version of the scene. I then have iPad and iPhone specific prefabs that leverage Sprite$$anonymous$$anager2 and are attached to the Game$$anonymous$$anager script running the scene. The only thing I don't care for is the increased output app size.

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

No one has followed this question yet.

Related Questions

Selecting at runtime the graphics API 2 Answers

Possible to render a simple colored spot rather than use a PNG? 0 Answers

Specifying a high quality background image for iPad 1 Answer

How to support Retina display 1 Answer

Accelerometer Movement Problem 2 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