- Home /
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 :)
Answer by Steven-Walker · Sep 22, 2011 at 12:09 AM
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.
Answer by amit-chai · Sep 22, 2011 at 01:12 AM
Well i got it from another post:
mainBG.SetPixels(mainBGSource.GetPixels());
Your answer
Follow this Question
Related Questions
Shader: How to map texture on a mesh without perspective/wrapping? 1 Answer
getPixels returning nan on iOS 0 Answers
How to set image in Aspect fit on Texture2D 0 Answers
How does setting the hideFlags resolve leaking issues? (Texture 2D leaking) 2 Answers
rotate an image by modifying Texture2D.GetPixels32() array 2 Answers