- Home /
Can I change a spritesheet's pixels in memory?
I'm considering porting my amateur game from pygame to Unity. One of the cooler features I have is random colors for enemies. The way I do it is by drawing a spritesheet using specific colors ([49,1,1] for Primary, [1,49,1] for Secondary, etc.). After loading it into memory, I then run a method to take, for instance, all pixels with color [49,1,1] and change them to .
Is a similar process doable in Unity? Or is there a much easier way of doing this that I'm overlooking?
Answer by Benproductions1 · May 22, 2013 at 05:40 AM
Hello,
I have previously used pygame and I can tell you... EVERYTHING is easier in Unity. If you want things to have random colors, you can just change the color of the material they use to render, or if your using GUI
you can literally set the color
of everything.
If you want to change a texture directly, you can cast it to Texture2D
and use the methods in it's documentation to do the same thing :)
Hope this helps,
Benproductions1
Thank you for that information. I can't wait to get started!
Your answer
![](https://koobas.hobune.stream/wayback/20220613102715im_/https://answers.unity.com/themes/thub/images/avi.jpg)