Draw picture in circle

I want to draw the picture of 4 players in circles, I am creating a turn based cards game.
currently I am drawing the picture like as follows :

Texture2D tex = (Texture2D)Resources.Load ("gambler", typeof(Texture2D)); 
GUI.DrawTexture (new Rect(playerPos[ID].x, playerPos[ID].y, 100, 70), tex );

Please help. Thanks in advance

I want to round the shape of the window in which players photo will be shown…

Here is a solution using World space:

  • Create a new shader. Name it ‘ProceduralCircle’
  • Place the contents of this shader as the text in the file: Prodecural_Circle_Mask.
  • Create a new material
  • Select the ‘Custom/Unlit Flat Circle v2’ shader for the material.
  • Add a face texture to the material (for testing)
  • Create a Quad (GameObject > Create Other > Quad)
  • Attach the created material to the Quad

You should now be seeing the texture you attached in a soft circle. You can adjust the ‘hardness’ up for a sharp circle…like a value of 100. You can change the picture by changing the renderer.material.mainTexture.

Using a shader is an efficient way of doing this task, but there are other ways:

  • If you really want the image showing in a GUITexture, then you can procedurally alter the texture…get the pixels of the textur, cycle through the pixels setting appropriate alpha values to 0.0.
  • You can use some sort of circular mesh in world space. You can try @meat5000 suggestion, but you likely want something with more vertices.
  • There are other shaders that use a mask, so the process is similar to the one I outlined above, but instead of the circular being procedural, it would come by the use of a circular grayscale image.