Posted By

Solipsist on 07/18/13


Tagged

Unity


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

danfinrud55


Rectangle with alpha (Unity)


 / Published in: C#
 

Draw rectangle with alpha (Unity GUI)

  1. public static void DrawRectangle(Rect rect, Color color, float alpha = 0f)
  2. {
  3. Texture2D texture = new Texture2D(1, 1);
  4. color.a = alpha;
  5. texture.SetPixel(0, 0, color);
  6. texture.wrapMode = TextureWrapMode.Repeat;
  7. texture.Apply();
  8. GUI.DrawTexture(rect, texture);
  9. }

Report this snippet  

You need to login to post a comment.