Last active
August 29, 2015 14:12
-
-
Save rafayali/54dc3680ed859be74aa2 to your computer and use it in GitHub Desktop.
Converts a color into a Texture2D format which can be written to a file or can be used as a regular texture
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private Texture2D MakeTex(int width, int height, Color col) | |
{ | |
Color[] pix = new Color[width * height]; | |
for( int i = 0; i < pix.Length; ++i ) | |
{ | |
pix[ i ] = col; | |
} | |
Texture2D result = new Texture2D( width, height ); | |
result.SetPixels( pix ); | |
result.Apply(); | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment