Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.
class in UnityEditor
Gracias por ayudarnos a mejorar la calidad de la documentación de Unity. A pesar de que no podemos aceptar todas las sugerencias, leemos cada cambio propuesto por nuestros usuarios y actualizaremos los que sean aplicables.
CerrarPor alguna razón su cambio sugerido no pudo ser enviado. Por favor <a>intente nuevamente</a> en unos minutos. Gracias por tomarse un tiempo para ayudarnos a mejorar la calidad de la documentación de Unity.
CerrarThe DrawGizmo attribute allows you to supply a gizmo renderer for any Component.
The renderer function must be static, and take two parameters: the object for which the gizmo is being drawn, and a GizmoType parameter which indicates the context in which the gizmo is being drawn.
The renderer function can be defined in any class, including editor scripts. This allows you to keep your gizmo-drawing code out of your component scripts so that it is not included in builds.
See Also: GizmoType.
no example available in JavaScript
using UnityEngine; using UnityEditor; public class MyScript : MonoBehaviour { } public class MyScriptGizmoDrawer { [DrawGizmo (GizmoType.Selected | GizmoType.Active)] static void DrawGizmoForMyScript (MyScript scr, GizmoType gizmoType) { Vector3 position = scr.transform.position; if(Vector3.Distance(position, Camera.current.transform.position) > 10f) Gizmos.DrawIcon (position, "MyScript Gizmo.tiff"); } }
DrawGizmo | Defines when the gizmo should be invoked for drawing. |