Version: 2018.1

Gizmos.DrawGUITexture

Switch to Manual
public static void DrawGUITexture (Rect screenRect, Texture texture, Material mat= null);
public static void DrawGUITexture (Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat= null);

Parameters

screenRect@param screenRect Размер и положение текстуры на "экране", заданном плоскостью XY.
texture@param texture Отображаемая текстура.
mat@param mat Опциональный материал, применяемый к текстуре.
leftBorder@param leftBorder Толщина левой стороны прямоугольника.
rightBorder@param rightBorder Ширина правой стороны прямоугольника.
topBorder@param topBorder Толщина верхней стороны прямоугольника.
bottomBorder@param bottomBorder Толщина нижней стороны прямоугольника.

Description

Рисует текстуру на сцене.

The chosen texture is drawn in 3D space on a "screen" defined by the XY plane (ie, the plane where the Z coordinate is zero). The values of the texture rectangle are given in scene units. The optional border values specify an inset from each edge within the rectangle in scene units; the texture is drawn inside the inset rectangle and the edge pixels are repeated outwards. This is a useful quick way to create a large background region around the main texture when its edges are of a single colour.

This function can be useful for creating GUI backgrounds in conjunction with a camera pointing directly at the texture.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { public Texture myTexture;

void OnDrawGizmosSelected() { // Draw a semitransparent blue cube at the transforms position Gizmos.DrawGUITexture(new Rect(10, 10, 20, 20), myTexture); } }