Best way to access the original texture ?

Hello,

I have an object that I’m painting it’s texture during the game, and at some point later. I would like to have the option to restore it to its original texture.

What would be the best way to access to the original texture? I can store the pixels in memory before I start changing them, but I’d rather not waste memory for that,

is there any way to access the un-edited texture of a material ?

This is a bit ugly, but you can load and then copy a file from Resources. Start with a material without a texture (or with a small texture) and at the start of the app:

Texture2D texDisk = (Texture2D)Resources.Load ("Test");
Texture2D texNew = new Texture2D(texDisk.width, texDisk.height);
texNew.SetPixels(texDisk.GetPixels ());
texNew.Apply ();
Resources.UnloadAsset(texDisk);
renderer.material.mainTexture = texNew;

Repeat this process when you want to restore the texture (no need to create a new texNew).