Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 Septikus · Apr 25, 2017 at 02:31 PM · spritetexture2dpngurlqualitysettings

Losing sprite quality when load .png from url

Hi everyone. I have problem with sprite quality after load png file from url. I use this code to load and set sprite on Image

 private IEnumerator RealLoadImage (string url, UnityEngine.UI.Image imageView) {
             if (imageCashe.ContainsKey (url)) {
                 if (imageView != null) {
                     imageView.sprite = imageCashe[url]; 
                 }
             } else {
                 //Call the WWW class constructor
                 WWW imageURLWWW = new WWW (url);  
             
                 //Wait for the download
                 yield return imageURLWWW;    
 
                 //Simple check to see if there's indeed a texture available
                 if(imageURLWWW.error == null){
                     if (imageURLWWW.texture != null) {
                     
                         //Construct a new Sprite
                         Sprite sprite = new Sprite ();     
                     
                         Texture2D image = new Texture2D(imageURLWWW.texture.width, imageURLWWW.texture.height, TextureFormat.ARGB32, true);
                         imageURLWWW.LoadImageIntoTexture(image);
                         image.SetPixels( image.GetPixels(0,0,image.width,image.height));
                         image.filterMode = FilterMode.Bilinear;
                         image.alphaIsTransparency = true;
                         image.Apply();
                         sprite = Sprite.Create(image, new Rect (0, 0, image.width, image.height), new Vector2(0,0));
 
                         if(!imageCashe.ContainsKey(url))
                         {
                             imageCashe.Add (url, sprite);
                         }
 
                         //Assign the sprite to the Image Component
                         if (imageView != null) 
                         {
                             imageView.sprite = sprite; 
                         }
                     }
                 }
                 else
                 {
                     Logger.LogError("Error to load img with url - " + url);
                     // делаем image прозрачным 
                     imageView.color = new Color(255,255,255,0);
                 }
                 imageURLWWW.Dispose ();
                 imageURLWWW = null;
             }
             imageView.enabled = true;
             yield return null;
         }

and get this result alt text

But, if I download this png file manual, move on resource and set this file on image, i get this

alt text

Why so big different with this sprites? And how get smooth sprite on dynamic load? Version Unity 5.4.0f3 and last version 5.6 get this problem too. Thanks a lot)

снимок-экрана-2017-04-25-в-121009.png (58.6 kB)
снимок-экрана-2017-04-25-в-121004.png (61.3 kB)
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

4 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by GravyGaming · Aug 31, 2017 at 08:19 PM

I'm having the same problem, and I couldn't found any solution yet, anyone can help with this?

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 GravyGaming · Sep 13, 2017 at 05:35 PM 0
Share

Unity Team, anyone can help with this problem?

avatar image
0

Answer by xarismax · Sep 13, 2017 at 06:30 PM

image.filterMode = FilterMode.Bilinear;

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 Septikus · Sep 14, 2017 at 04:53 AM 0
Share

I'm do it on my script, after load image

avatar image
0

Answer by Gokcan · Aug 26, 2021 at 11:47 AM

Still no answer? I have same issue after 4 years

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 isotian · Aug 26, 2021 at 02:40 PM

Me too... Does anybody have new ideas?

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

7 People are following this question.

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

Related Questions

Best texture compression: TinyPNG + Unity sprite Packer? 1 Answer

Loading a Sprite (Unity 4.3) in resource folder and setting it in sprite renderer 6 Answers

Combine Array of Sprites to Form One Sprite 0 Answers

Reference Specific Sprites from Atlas 1 Answer

iOS crash with "Memory pressure" error - too many sprites? 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