/// <summary> /// change all black pixels to color, for texture 2D /// </summary> /// <param name="texture"></param>GameTexture to modify /// <param name="color"></param> color to change shape to /// <returns></returns> new texture with modfied color public static Texture2D changeColor(Texture2D texture, GameColor color) { Texture2D returnTexture = new Texture2D(texture.width, texture.height); for (int x = 0; x < returnTexture.width; x++) { for (int y = 0; y < returnTexture.height; y++) { if (GameColor.isColor(texture.GetPixel(x, y), "black")) { returnTexture.SetPixel(x, y, color.getColor()); } else { returnTexture.SetPixel(x, y, Color.clear); } } } return(returnTexture); }