- Home /
What format will allow me to copy a texture on Android in real time?
Hey folks,
I'm building a simple painting app for Android and want to be able to copy from a default texture to a new texture and then write my paint to it using a Render Texture.
Everything is working just great in editor, but the atlas texture (Default, read/write enabled, RGBA 32 bit) is not displaying correctly on the model (a house) when in Android.
baseMaterial.maintexture = new Texture2D(houseTexture.width, houseTexture.height, houseTexture.format, true);
Graphics.CopyTexture(houseTexture, baseMaterial.mainTexture);
Does anybody know what kind of texture format I should be using to ensure it displays in Unity Android? Have tried all options available under Format in the image import Inspector, and I'm just getting a grey box with seemingly random lines, or the object is covered in one of the main colours (a pastel peach) from the texture (suggesting a UV issue?).
I'm honestly baffled, and if somebody has experience with this I'd be most grateful.
EDIT: So, I'm running my .apk with the Logcat settings found on this page and all I'm getting are standard errors, no suggestions of what's causing the problems - I thought I might find something indicating that Graphics.CopyTexture isn't working, but no dice. The current import settings for the 2D texture atlas are Read/Write Enable == true, with the format as RGBA 32 bit - and all I'm getting is just a grey/white texture on my model (which, ideally, should display a copy of the original house texture). I'm also confused as hell as to how to put line breaks into this format.
Answer by Reverend-Speed · Jan 19, 2019 at 06:00 PM
Ultimately, I switched to using the GetPixels32 method and ensured that I called .Apply() on the texture when it was copied over. Seems to do the job more reliably than Graphics.Copy on mobile. Have a good 'un!
Your answer
