返回介绍

Gizmos.DrawGUITexture 绘制GUI纹理

发布于 2019-12-18 15:37:43 字数 3913 浏览 1459 评论 0 收藏 0

JavaScript => public static function DrawGUITexture(screenRect: Rect, texture: Texture, mat: Material = null): void;
JavaScript => public static function DrawGUITexture(screenRect: Rect, texture: Texture, leftBorder: int, rightBorder: int, topBorder: int, bottomBorder: int, mat: Material = null): void;
C# => public static void DrawGUITexture(Rect screenRect, Texture texture, Material mat = null);
C# =>public static void DrawGUITexture(Rect screenRect, Texture texture, int leftBorder, int rightBorder, int topBorder, int bottomBorder, Material mat = null);

Parameters 参数

screenRectThe size and position of the texture on the “screen” defined by the XY plane.
textureThe texture to be displayed.
matAn optional material to apply the texture.
leftBorderInset from the rectangle's left edge.
rightBorderInset from the rectangle's right edge.
topBorderInset from the rectangle's top edge.
bottomBorderInset from the rectangle's bottom edge.

Description 描述

Draw a texture in the scene.

在屏幕上绘制纹理。

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.

选择的纹理绘制在3D空间的XY平面中的屏幕上(即该平面Z轴为0)。纹理矩形的值指定了场景单位。选择的边界值指定了插入的矩形每条边(场景单位);该纹理绘制于矩形的内部并且边缘像素向外重叠。当主要纹理的边缘是单一颜色时,可以使用该函数快速创建一个大的背景区域。

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

该函数可用于在坐标上摄像机直接指向的纹理创建GUI背景。

JavaScript:

var myTexture : Texture;
 
	function OnDrawGizmos () {
	 	Gizmos.DrawGUITexture(Rect(10, 10, 20, 20), myTexture);
	}

C#:

var myTexture : Texture;
 
	function OnDrawGizmos () {
	 	Gizmos.DrawGUITexture(Rect(10, 10, 20, 20), myTexture);
	}

gizmos

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文