p1 | @param p1 Точка начала |
p2 | @param p2 Точка конца |
screenSpaceSize | @param screenSpaceSize Размер в пикселях для длины сегментов линии и зазора между ними. |
Рисует линию из точек из p1 до p2.
"Кривая Безье в окне Scene".
The following example uses DrawDottedLine to draw a line between an object and the objects defined in a list.
To use this example, save the following script into the Assets/Editor folder:
using UnityEngine; using UnityEditor;
[CustomEditor( typeof( DrawDottedConnectedLine ) )] public class DrawDottedConnectedLineEditor : Editor { void OnSceneGUI( ) { DrawDottedConnectedLine t = target as DrawDottedConnectedLine;
if( t == null || t.GameObjects == null ) return;
Vector3 center = t.transform.position;
for( int i = 0; i < t.GameObjects.Length; i++ ) { if( t.GameObjects[i] != null ) Handles.DrawDottedLine( center, t.GameObjects[i].transform.position, t.DashSize ); } } }
...then attach this script to the anchor object which you would like to see lines eminate from. Drop GameObjects you would like lines drawing to into the array in the script's inspector, and adjust the gap between the dotted lines accordingly:
using UnityEngine;
[ExecuteInEditMode] public class DrawDottedConnectedLine : MonoBehaviour { public GameObject[] GameObjects; public float DashSize = 4; }