Rectangle with alpha (Unity)


/ Published in: C#
Save to your folder(s)

Draw rectangle with alpha (Unity GUI)


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.