unity3d - How to use GUITexture in unity -


i'm newbie unity. i've seen guitexture in scripting , don't know how use it. want know can guitexture , how show guitexture on screen. please me.

gui(graphic user interface) textures, images can displayed on screen , adding layer on camera. mean if place gui texture on screen, no matter player goes, appear in same position relative players camera. example of using gui textures if wanted make health bar displayed in corner of players view.

how use gui textures:

public class testgui {      //declare texture, can multiple ways      public texture texturetype1;      //this type more blurry because being rendered texture rather plain image      public 2dtexture texturetyple2;      //this type less blurry texture, , used 2d elements      public guitexture texturetype3;      //this type clearest , meant solely gui       public void ongui()      {           gui.drawtexture(new rect(xoffset, yoffset, width, height), texturetype3);           //this texture drawn not fill rectangle declared           gui.drawtexture(new rect(xoffset, yoffset, width, height), texturetype3, scalemode.scaletofit, true, 1.0f);           //this texture drawn , scaled fill dimensions of rectangle declared fill aspect ratio of 1.           //this things health bars since doesnt matter if image stretched since color      } } 

Comments

Popular posts from this blog

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

php - Zend Framework / Skeleton-Application / Composer install issue -