SetPixels/Apply() doesn't keep changes after restart.

So I paint over a texture with with SetPixel, then I fill an array with the color values for that texture. Finally I apply that array of color values onto the root texture.

However, whenever I restart the texture goes back to the original non painted on version. I thought I was writing to the actual texture not a copy by doing this:

var RootTexture : Texture2D;

then finding the texture I’m using in the project tab, and assigning it to that variable. Then when I get said array of color values from the new painted on texture I do this,


Where the PixelArray is the array of colors obtained form the current texture. Now when I look in the Project menu at the texture IT IS modified, but when I restart it goes back to normal.

I saw a lot of question on how to reset a texture after you Apply() but I want the opposite, for the texture to be permanently changed, so that it is still ‘painted’ on after a restart.

Thanks for your time.

As unity manual says, in desktop platforms modifications to Texture2D’s is permenant.
Do you drag a Texture file in inspector to your rootTexture variable? If yes, it should work in windows and mac builds and editor.
If no then use the sharedMaterial property and it’s mainTexture instead of material.mainTexture. I bring this up because at list in your code herethe variable seem private.

manual page here