Unity – Scripting – GUITexture

Unity – Scripting – GUITexture (get from gui and code it)

GUI Texture

1. MAIN TOP MENU> GameObject> Create Other> GUI Texture

2. The text will create the GameObject ‘UnityWatermark-small’ in the Viewport

3. Project> Assets, select ‘UnityWatermark-small’> Inspector, setup the texture default parameters

4. Attach this JS Script at GameObject ‘GUI Text’:

#pragma strict
 
        // Assign someTexture to the guiTexture
	var someTexture : Texture2D;
	guiTexture.texture = someTexture;   

5. DRAG AND DROP a Texture from Assets to Inspector> GUITexture> JS Script> Some Texture

Properties List

border The border defines the number of pixels from the edge that are not affected by scale.
color The color of the GUI texture.
pixelInset Pixel inset used for pixel adjustments for size and position.
texture The texture used for drawing.