Version: 2018.4
public static void DrawTexture (Rect screenRect, Texture texture, Material mat= null, int pass= -1);
public static void DrawTexture (Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat= null, int pass= -1);
public static void DrawTexture (Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat= null, int pass= -1);
public static void DrawTexture (Rect screenRect, Texture texture, Rect sourceRect, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Color color, Material mat= null, int pass= -1);

パラメーター

screenRectテクスチャに使用するスクリーン上のレクタングル。ピクセルで左上隅の (0,0) の座標。
textureテクスチャを表示する位置。左上が(0, 0) になる
sourceRect使用するテクスチャの領域。左下隅を (0,0) で正規化された座標。
leftBorderスケールの影響を受けない左からのピクセル数。
rightBorderスケールによって影響されない右端からのピクセル数
topBorderスケールによって影響されない上端からのピクセル数
bottomBorderスケールによって影響されない下端からのピクセル数
color出力を調節する Color 。中間の値は (0.5, 0.5, 0.5, 0.5) です。シェーダーの頂点カラーとして設定します。
matカスタム Material テクスチャを描画するために使用できます。 null が渡された場合、 Internal-GUITexture.shader とデフォルトのマテリアルが使用されます。
pass-1 (デフォルト) の場合、マテリアルのすべてのパスを描画します。そうでなければ、指定されたパスだけを描画します。

説明

設定した座標にテクスチャを描画する

If you want to draw a texture from inside of OnGUI code, you should only do that from EventType.Repaint events. It's probably better to use GUI.DrawTexture for GUI code.

using UnityEngine;

public class Example : MonoBehaviour { // Draws a texture on the screen at 10, 10 with 100 width, 100 height.

Texture aTexture;

void OnGUI() { if (Event.current.type.Equals(EventType.Repaint)) { Graphics.DrawTexture(new Rect(10, 10, 100, 100), aTexture); } } }