Version: 2017.2

GUI.DrawTexture

Cambiar al Manual
public static void DrawTexture (Rect position, Texture image);
public static void DrawTexture (Rect position, Texture image, ScaleMode scaleMode);
public static void DrawTexture (Rect position, Texture image, ScaleMode scaleMode, bool alphaBlend);
public static void DrawTexture (Rect position, Texture image, ScaleMode scaleMode, bool alphaBlend, float imageAspect);

Parámetros

position Rectangle on the screen to draw the texture within.
image Texture to display.
scaleMode How to scale the image when the aspect ratio of it doesn't fit the aspect ratio to be drawn within.
alphaBlend Whether to apply alpha blending when drawing the image (enabled by default).
imageAspect Aspect ratio to use for the source image. If 0 (the default), the aspect ratio from the image is used. Pass in w/h for the desired aspect ratio. This allows the aspect ratio of the source image to be adjusted without changing the pixel width and height.

Descripción

Draw a texture within a rectangle.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Texture aTexture; void OnGUI() { if (!aTexture) { Debug.LogError("Assign a Texture in the inspector."); return; } GUI.DrawTexture(new Rect(10, 10, 60, 60), aTexture, ScaleMode.ScaleToFit, true, 10.0F); } }

public static void DrawTexture (Rect position, Texture image, ScaleMode scaleMode, bool alphaBlend, float imageAspect, Color color, float borderWidth, float cornerRadius);
public static void DrawTexture (Rect position, Texture image, ScaleMode scaleMode, bool alphaBlend, float imageAspect, Color color, Vector4 borderWidths, float cornerRadius);

Parámetros

position Rectangle on the screen to draw the texture within.
image Texture to display.
scaleMode How to scale the image when the aspect ratio of it doesn't fit the aspect ratio to be drawn within.
alphaBlend Whether to apply alpha blending when drawing the image (enabled by default).
imageAspect Aspect ratio to use for the source image. If 0 (the default), the aspect ratio from the image is used. Pass in w/h for the desired aspect ratio. This allows the aspect ratio of the source image to be adjusted without changing the pixel width and height.
color A tint color to apply on the texture.
borderWidth The width of the border. If 0, the full texture is drawn.
borderWidths The width of the borders (left, top, right and bottom). If Vector4.zero, the full texture is drawn.
cornerRadius The radius for rounded corners. If 0, corners will not be rounded.

Descripción

Draws a border with rounded corners within a rectangle. The texture is used to pattern the border. Note that this method only works on shader model 2.5 and above.