Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Runtime Texture2D Import Compression

Discussion in 'Editor & General Support' started by Clonze, Dec 19, 2019.

  1. Clonze

    Clonze

    Joined:
    Dec 15, 2012
    Posts:
    26
    EDIT: PROBLEM SOLVED.

    I have also tried using the up to date UnityWebRequestTexture, but I run into the same problem.
    Having the exact same colors that the PNG file has is very important!
    Here's the runtime image import snippet:

    Code (CSharp):
    1.  
    2.         WWW data = new WWW("file:///" + url);
    3.         yield return data;
    4.    
    5.         settings.texture = data.textureNonReadable;
    6.  
    7.         settings.texture.wrapMode = TextureWrapMode.Clamp;
    8.         settings.texture.filterMode = FilterMode.Point;
    9.         settings.texture.Apply(false, true);
    10.         data.Dispose();
    11.         data = null;
    12.  
    NOTE: ALL OF THESE COLORS SHOULD BE THE SAME. rgb(228, 96, 24)

    small image means it is a small spritesheet (4 frames, of width:256 height: 176)
    largeimage means it is a largespritesheet (24 frames, of width:256 height: 176)
     
    Last edited: Dec 19, 2019
  2. Clonze

    Clonze

    Joined:
    Dec 15, 2012
    Posts:
    26
    NVM. twhen I resaved the image in photoshop > save for web + convert to sRGB the problem went away.