Manual     Reference     Scripting  
  
Scripting > Runtime Classes > Gizmos   
  • Menu
  • Overview
  • Runtime Classes
  • Attributes
  • Enumerations
  • Editor Classes
  • Enumerations
  • History
  • Index
  • Gizmos
  • All Members
  • Class Variables
  • color
  • matrix
  • Class Functions
  • DrawCube
  • DrawGUITexture
  • DrawIcon
  • DrawLine
  • DrawRay
  • DrawSphere
  • DrawWireCube
  • DrawWireSphere

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.

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

JavaScripts
// 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.

function OnDrawGizmos () {
Gizmos.DrawIcon (transform.position, "Light Gizmo.tiff");
}

using UnityEngine;
using System.Collections;

public class example : MonoBehaviour {
void OnDrawGizmos() {
Gizmos.DrawIcon(transform.position, "Light Gizmo.tiff");
}
}

import UnityEngine
import System.Collections

class example(MonoBehaviour):

def OnDrawGizmos():
Gizmos.DrawIcon(transform.position, 'Light Gizmo.tiff')