DrawTextureWithTexCoords

说明根据给定的纹理坐标绘制矩形

用法

public static void DrawTextureWithTexCoords(Rect position, Texture image, Rect texCoords);
public static void DrawTextureWithTexCoords(Rect position, Texture image, Rect texCoords, bool alphaBlend);

参数

position

矩形区域的位置和尺寸。

image

要绘制的贴图。

texCoords

要绘制的纹理坐标。

alphaBlend

是否应用透明度混合(默认为是)。

示例

private void OnSceneGUI () {
		Handles.BeginGUI ();
	
		GUI.DrawTextureWithTexCoords (new Rect (5, 5, 100, 100), _target._texture, new Rect (_target._x, _target._y, _target._width, _target._height));
	
		GUI.DrawTexture (new Rect (110, 5, 200, 200), _target._texture);
		GUI.DrawTexture (
				new Rect (110 + 200 * _target._x, 5 + 200 - 200 * (_target._y + _target._height), 200 * _target._width, 200 * _target._height),
				Texture2D.whiteTexture,
				ScaleMode.StretchToFill,
				true, 0,
				new Color (255, 0, 0, 1),
				1, 0
		);
	
		Handles.EndGUI ();
}