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);

Parameters

screenRect@param screenRect Прямоугольник на экране, используемый для текстуры. В пиксельных координатах левый верхний угол имеет координаты (0,0).
texture@param texture Texture для рисования.
sourceRect@param sourceRect Используемая область текстуры. В нормализованных координатах нижний левый угол имеет координаты (0,0).
leftBorder@param leftBorder Количество пикселей слева, не зависящих от масштаба.
rightBorder@param rightBorder Количество пикселей справа, независящих от масштаба.
topBorder@param leftBorder Количество пикселей слева, не зависящих от масштаба.
bottomBorder@param leftBorder Количество пикселей слева, не зависящих от масштаба.
color Color that modulates the output. The neutral value is (0.5, 0.5, 0.5, 0.5). Set as vertex color for the shader.
mat@param mat Пользовательский Material, который может быть использован при рисовании текстуры. Если задан null, используется материал по умолчанию с шейдером Internal-GUITexture.shader.
pass@param pass Если равно -1 (по умолчанию), то рисует все проходы материала. Иначе, рисует только указанный проход.

Description

Рисует текстуру в координатах экрана.

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); } } }