Gizmos.DrawIcon 绘制图标

static function DrawIcon (center : Vector3, name : string) : void

Description描述

Draw an icon at world position in the scene view.

在场景视图世界位置绘制一个图标。

The icon has to be named name and is going to be planced at center. The icon's path can be found in the Assets/Gizmos folder or in the Unity.app/Contents/Resources folder.

图标被命名为name并且被放置在center处。图标的路径在Assets/Gizmos文件夹或Unity.app/Contents/Resources文件夹

DrawIcon can be used to allow quick picking of important objects in your game.

DrawIcon可以被用于在你的游戏中快速选择重要的物体。

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
	void OnDrawGizmos() {
		Gizmos.DrawIcon(transform.position, "Light Gizmo.tiff");
	}
}
// Draws the Light bulb icon at position of the object.
// Because we draw it inside OnDrawGizmos the icon is also pickable
// in the scene view.
//在物体的位置绘制一个灯泡图标,因为我们是在OnDrawGizmos 中绘制,图标在场景视图可以点选的
function OnDrawGizmos () {
	Gizmos.DrawIcon (transform.position, "Light Gizmo.tiff");
}
最后修改:2010年12月26日 Sunday 0:02

本脚本参考基于Unity 3.4.1f5

英文部分版权属©Unity公司所有,中文部分© Unity圣典 版权所有,未经许可,严禁转载 。