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

}
Page last updated: 2010-12-26