Search Unity

Displaying Avatar image in HUD GUI?

Discussion in 'Scripting' started by TroyDavis, Oct 19, 2013.

  1. TroyDavis

    TroyDavis

    Joined:
    Mar 27, 2013
    Posts:
    78
    I've searched and searched on an example of how to display, or make and image to display in a GUI Texture, of your character avatar. I have setup a Render Texture and been able to set it to a GUI Texture but it's transparent and difficult to see. Anyone else know of a way. I really just want to be able to display the modified avatar image in a HUD GUI window.:eek:
     
  2. TroyDavis

    TroyDavis

    Joined:
    Mar 27, 2013
    Posts:
    78
    I don't normally bump my own posts but seriously am i the only one that's ever decided to do this in their game? Surely someone out there has created a similar UI display that shows the players head in it?
     
  3. laurelhach

    laurelhach

    Joined:
    Dec 1, 2013
    Posts:
    229
    Here you go:
    Create a Texture2D variable (myTexture2D) and drag your texture in the inspector.
    Then somewhere in your OnGUI() method call this :
    Code (csharp):
    1.  
    2. GUI.Label(new Rect(customRect), myTexture2D);
    3.  
     
  4. TroyDavis

    TroyDavis

    Joined:
    Mar 27, 2013
    Posts:
    78
    That's not what i'm asking. I'm asking how to display the camera image or animated image of the player models head inside of the texture area.
     
  5. Kokumo

    Kokumo

    Joined:
    Jul 23, 2010
    Posts:
    416
    I will not give you the answer but a suggestion: search for minimap creation.
    You will need a camera, set what layers you want to render, and how to show the camera into a GUI area... which, in fact, is something easy (but I can't remember how).
    You may find some useful articles here: http://wiki.unity3d.com/index.php/Main_Page
     
  6. TroyDavis

    TroyDavis

    Joined:
    Mar 27, 2013
    Posts:
    78
    Thanks I figured it out. The solution is using a Render Texture...