Version: 5.3 (switch to 5.4b)
IdiomaEnglish
  • C#
  • JS

Idioma de script

Selecciona tu lenguaje de programación favorito. Todos los fragmentos de código serán mostrados en este lenguaje.

Handles.DrawWireDisc

Sugiere un cambio

¡Éxito!

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.

Cerrar

No se puedo enviar

Por 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.

Cerrar

Cancelar

Cambiar al Manual
public static function DrawWireDisc(center: Vector3, normal: Vector3, radius: float): void;
public static void DrawWireDisc(Vector3 center, Vector3 normal, float radius);

Parámetros

center The center of the dics.
normal The normal of the disc.
radius The radius of the dics

Note: Use HandleUtility.GetHandleSize where you might want to have constant screen-sized handles.

Descripción

Draw the outline of a flat disc in 3D space.


Wire Disc in the Scene View.

To use this example, save this script in the Assets/Editor folder:


        
using UnityEngine;
using UnityEditor;

[CustomEditor( typeof( DrawWireDisc ) )] public class DrawWireDiscEditor : Editor { void OnSceneGUI( ) { DrawWireDisc t = target as DrawWireDisc;

Handles.color = Color.blue; Handles.Label( t.transform.position + Vector3.up * 2, t.transform.position.ToString( ) + "\nShieldArea: " + t.shieldArea.ToString( ) );

Handles.BeginGUI( ); GUILayout.BeginArea( new Rect( Screen.width - 100, Screen.height - 80, 90, 50 ) );

if( GUILayout.Button( "Reset Area" ) ) t.shieldArea = 5;

GUILayout.EndArea( ); Handles.EndGUI( );

Handles.color = new Color( 1, 1, 1, 0.2f ); Handles.DrawWireDisc( t.transform.position, t.transform.up, t.shieldArea ); Handles.color = Color.white; t.shieldArea = Handles.ScaleValueHandle( t.shieldArea, t.transform.position + t.transform.forward * t.shieldArea, t.transform.rotation, 1, Handles.ConeCap, 1 ); } }

...and place this script on the object where you want the disc to appear:


        
using UnityEngine;

[ExecuteInEditMode] public class DrawWireDisc : MonoBehaviour { public float shieldArea = 5; }