- Home /
Do the Texture2D methods behave differently in a release build?
I try to reduce the size of a texture by half. For this I use the code
Color32[] tOrigData = mCurrentTexture.GetPixels32(1);
mCurrentTexture.Resize(mCurrentTexture.width >> 1, mCurrentTexture.height >> 1, mCurrentTexture.format, true);
mCurrentTexture.SetPixels32(tOrigData, 0);
mCurrentTexture.Apply(true, false);
which works fine in the editor. If I build for Windows however the result is just a white texture, as if Apply() was not called.
Maybe this is a bug or I misuse it. I didn't build for any other platform yet and will update this post once I tried a different platform.
I also tried to copy the Color32[] array shallow and deep, and both didn't work.
Thanks in advance for any help!
Comment
Best Answer
Answer by CGMan · Jan 23, 2017 at 02:12 PM
I found an alternative solution for my problem.
At the beginning I save the result of mCurrentTexture.GetPixels32(1) to the cache folder at Application.temporaryCachePath().
Then I load it back again when I need it.