Version: 2023.2
言語: 日本語
public static void DrawLineList (ReadOnlySpan<Vector3> points);

パラメーター

points Pairs of points to use as the beginning and end of each line to draw. Unity throws an exception if points contains an odd number of elements.

説明

Draws multiple lines between pairs of points.

This function provides a more efficient way to draw multiple lines than repeatedly calling the Gizmos.DrawLine function for each one.

Each pair of points from the points span represents the start and end of each line, so Unity draws the first line from points[0] to points[1], the next from points[2] to points[3], and so on.

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { Vector3[] points;

void Start() { points = new Vector3[4] { new Vector3(-100, 0, 0), new Vector3(100, 0, 0), new Vector3(-100, 100, 0), new Vector3(100, 100, 0) }; }

void OnDrawGizmosSelected() { // Draws two parallel blue lines Gizmos.color = Color.blue; Gizmos.DrawLineList(points); } }

See Also: Gizmos.DrawLine, Gizmo.DrawLineStrip.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961