Search Unity

EncodeToPNG return null

Discussion in 'World Building' started by Bagazi, Jul 16, 2019.

  1. Bagazi

    Bagazi

    Joined:
    Apr 18, 2018
    Posts:
    611
    I encoded a tex2D into png by upload_2019-7-16_16-21-23.png

    the pixel array is correct
    upload_2019-7-16_16-22-58.png

    But after EncodeToPNG,the byte array "data" was null ...
     

    Attached Files:

  2. grizzly

    grizzly

    Joined:
    Dec 5, 2012
    Posts:
    357
    You need to call Apply straight after SetPixels. Move newTex.Apply() to line 63.
     
    JoeStrout likes this.