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
1
Question by NathanSimbahan · Jul 31, 2012 at 08:39 AM · iostexturewwwloadimageintotexture

Loading Images using WWW into a different texture format

Hi,

We are trying to load images from an external resource. In order to do this, we used WWW class and then create a new Texture2D image. We're using the sample script from this source: http://docs.unity3d.com/Documentation/ScriptReference/WWW.LoadImageIntoTexture.html

 renderer.material.mainTexture = new Texture2D(1024, 1024, TextureFormat.PVRTC_RGBA4, false);
 while(true) {
     // Start a download of the given URL
     var www = new WWW(url);

     // wait until the download is done
     yield www;

     // assign the downloaded image to the main texture of the object
     www.LoadImageIntoTexture(renderer.material.mainTexture);
 }

For some reason, the loaded image is taking up too much memory and it looks like it's loading an RGBA32 format instead of the PVRTC_RGBA4 format.

Our target platform is iOS and we're assuming that the texture format is supported.

Our Unity version is 3.5.0.f5

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

2 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Paulius-Liekis · Aug 01, 2012 at 01:54 PM

You're loading png or jpg, so they are not compressed with PVRTC, so you get texture in RGBA32. Unity can create PVRTC textures only on Editor, because that's where compression code lives. It can not compresses textures in runtime.

Anyway, I think you're problem is that you have infinite loop. At least I don't see any break statement.

Comment
Add comment · Show 1 · 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 NathanSimbahan · Aug 02, 2012 at 06:05 AM 0
Share

oh, okay. So there is no runtime conversion (workaround) to pvrtc? Anyway, The code provided is just a sample code the main problem was that I was using too much memory since Unity loads PNGS into RGBA32 format. thanks!

avatar image
0

Answer by codehead · Oct 21, 2012 at 10:20 PM

You can download a pre-compressed texture from the server and upload it to the device texture memory. I'm doing it on Android and posted the code to another question :)

http://answers.unity3d.com/questions/184840/download-and-use-pvrtc-texture-ios.html

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

8 People are following this question.

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

Related Questions

Ios www.texture returns question mark 1 Answer

unity3d www download of large texture mobile 0 Answers

Glitch when using WWW.LoadImageIntoTexture(...) 2 Answers

LoadImageIntoTexture on iPhone from the device disk 1 Answer

Webplayer crash on LoadImageIntoTexture call 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