Graphics.DrawTexturestatic function DrawTexture (screenRect : Rect, texture : Texture, leftBorder : int, rightBorder : int, topBorder : int, bottomBorder : int, mat : Material = null) : voidstatic function DrawTexture (screenRect : Rect, texture : Texture, sourceRect : Rect, leftBorder : int, rightBorder : int, topBorder : int, bottomBorder : int, mat : Material = null) : voidstatic function DrawTexture (screenRect : Rect, texture : Texture, sourceRect : Rect, leftBorder : int, rightBorder : int, topBorder : int, bottomBorder : int, color : Color, mat : Material = null) : voidParameters
DescriptionDraw a texture in screen coordinates. 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.
JavaScripts
// Draws a texture on the screen at 10, 10 with 100 width, 100 height.
var aTexture : Texture; function OnGUI() { if(Event.current.type.Equals(EventType.Repaint)) Graphics.DrawTexture(Rect(10, 10, 100, 100), aTexture); } using UnityEngine;
using System.Collections; public class example : MonoBehaviour { public Texture aTexture; void OnGUI() { if (Event.current.type.Equals(EventType.Repaint)) Graphics.DrawTexture(new Rect(10, 10, 100, 100), aTexture); } } import UnityEngine
import System.Collections class example(MonoBehaviour): public aTexture as Texture def OnGUI(): if Event.current.type.Equals(EventType.Repaint): Graphics.DrawTexture(Rect(10, 10, 100, 100), aTexture)
|
