Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. // Returns of a solid texture of width * height of color 'color'
  2. private Texture2D MakeTextureColor(int width, int height, Color color)
  3. {
  4. // Create an array to contain all of our pixels
  5. Color[] pixels = new Color[width * height];
  6.  
  7. // Set each pixel to our color
  8. for (int i = 0; i < pixels.Length; i++) {
  9. pixels [i] = color;
  10. }
  11.  
  12. // Apply the color to the texture
  13. Texture2D output = new Texture2D (width, height);
  14. output.SetPixels (pixels);
  15. output.Apply ();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement