Skip to main content
Support
Search our knowledge base

How can I get pixels from unreadable textures?

Comments

4 comments

  • Arnaud

    Typo in your script:

    // Create a new readable Texture2D to copy the pixels to it
    Texture2D myTexture2D = new Texture2D(texture.width, texture.width);

    Above has "width" twice. Supposed to be: 

    new Texture2D(texture.width, texture.height);

    Otherwise, it helped me a lot, thanks!

     

    0
  • Sergio Gomez

    Fixed! thanks.

    0
  • Crash Helmet

    Very helpful, thanks.

    Something I ran into afterwards; pixel coordinates for PC & iOS are different, as described here:

    https://docs.unity3d.com/Manual/SL-PlatformDifferences.html

    https://docs.unity3d.com/ScriptReference/SystemInfo-graphicsUVStartsAtTop.html

    0
  • sama.van

    Very helpful for Standalone and Android but hours of pain of debugging from iOS.

    RenderTexture seems to be refreshed/cleared (Call it as you want) each time you call it from StandAlone and Android which let you use it for many texture in the same frame.

    On iOS, you should call it once a frame or that will just render the first one called.

    No idea why but the the per update trick is 100% working on iOS now.

    Running with Unity 2019.3.0f1

    0

Please sign in to leave a comment.