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 donid · Aug 23, 2016 at 07:40 AM · texturemobile devicesasynchronous

Loading big panos >10M (8k) without freeze on the main thread

Hi, We have a simple app that loads panoramas from external sources (not prepared by unity and no way to change that). And while loading a new pano (next one in line) we fade out to black and then once it's loaded fade into the new pano. Unfortunately the main thread freezes while the image is being loaded (presumably while it's being decompressed and loaded into memory). Is there a way to work around this? So we don't get the main scene frozen? Or can we at least give an animated indicator (rounding circle or something similar) that would give the user a feedback that we are working on it rather than giving the idea that the app crashed by the blackout?

Thanks, Dominik

Comment
Add comment · Show 2
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 tanoshimi · Aug 23, 2016 at 08:57 AM 1
Share

Well, the first question that comes to $$anonymous$$d is why you can't do this in a separate thread?

avatar image Bunny83 · Aug 23, 2016 at 10:11 AM 1
Share

The first question that comes to my $$anonymous$$d is: How do you actually load it at the moment? ^^ You should include the code that you're using. You also did not specify what format this image has (format, not resolution)

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Baktillus · Aug 23, 2016 at 09:22 AM

You might be able to find help here. Basically try using WWW and load in the background. Still hickups can occur when the texture is being created i think.

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 Bunny83 · Aug 23, 2016 at 10:34 AM

Depending on the format of your image you can use some thirdparty library to load and decode the image on a seperate thread, Once you have the pixel data, make sure to convert it into a Color32 array. Finally you will use Texture2D.SetPixels32 on the main thread to actually create the texture and apply the data. If this is still too heavy, you might want to break down the big array into smaller rectangular chunks (8kx8k might by split into 64 x 1k x 1k) and use the second overload of SetPixels32 which allows you to just set a portion of the texture at a time. Of course this might be done in a corouine where you can display the progress after each 1k chunk.

Keep in mind that a 8kx8k image requires at least 256 MB in memory. As Color array (instead of Color32) it would even take 1 GB.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

load texture asynchronously 1 Answer

Massive Texture Loading 0 Answers

How to make the back image appear before the front image where it is scratched? 0 Answers

Objects Not Rendering On Android 1 Answer

Best way for animated adds on banners in unity3d mobile sport games 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