Preventing modifications to textures when using SetPixel

My game dynamically updates splatmaps associated with a terrain, but I’ve found these changes are permanently saved back to the texture. While this would be really useful if I was using this to extend the editor, it’s less than desirable to have my missile scorch damage etched onto the terrain forever after a quick playtest :slight_smile:

I could potentially duplicate the texture in the script before the game began, but there isn’t a programmatic way to apply a new splatmap texture to a terrain at present (and in any case, this seems like a hack). I also checked out the HideFlags, but these don’t seem to do what I want.

Any tips? [Edit: have the post a better title]

Hey Hayden. Eric and Yoggy posted really cool packages here. I used Erics as reference for my project and he clones a texture at runtime, which achieves what I think your after. Read his comments in his script.

http://forum.unity3d.com/viewtopic.php?t=5790

Cheers
AC

Thanks, there’s some good thoughts in that thread!

That said, terrain is a little different, because all the properties aren’t accessible to scripts yet. Still, I’ll work something out.