Reloading texture2d from code

hi im using a script to change a texture2d at runtime (painter app), is there a way to reset all the chagnes made with the painter? like Reloading but at runtime.
please help :slight_smile:

2 Answers

2

How about using Texture2D.LoadImage()?

http://unity3d.com/support/documentation/ScriptReference/Texture2D.LoadImage.html

Or another way you might try is using WWW.texture

http://unity3d.com/support/documentation/ScriptReference/WWW-texture.html

Well, you'll have to make a copy of your texture2D befor you start editing it, and then to reload, just load the copy! This works basically the same way any editor would.

–

Well i got it from another post:

mainBG.SetPixels(mainBGSource.GetPixels());