How to get Color32 block from a runtime generated Texture2D?
I am generating a Texture2D in RGBA32 format runtime. I want to get a pixel color block from the texture.
There is a function in Unity API which provides exactly that but the Array provided is in Color format. See:
Texture2D.GetPixels(x,y,width,height); // This returns a color block in Color format There is no function to get the same in Color32 format. like GetPixels32(x,y,width,height) !!
In Color32 class there is a function to SetPixels32 however which can take x,y,width,height for changing a color black which is very weird !!
Can anybody help please? Should I convert the returned Color[] array to Color32[] array and then use SetPixels32(x,y,width,height)
The reason I am trying to stay in Color32 thing is because it provides performance benefits and I am changing lots of texture colors runtime and performance provided by Color32 is important. Thank you
Your answer
Follow this Question
Related Questions
Make texture2D readable in runtime/script Unity3D 1 Answer
How can I reset the score counter? 0 Answers
Material.SetTexture doesn't work if not "_MainTex" 0 Answers
2D advanced texture blurriness 1 Answer
Texure2D is not changing 1 Answer