Gizmos.DrawLine 调试

Gizmos.DrawLine

主要用于调试

public static void DrawLine(Vector3 from, Vector3 to);
参数
画一条线从fromto

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Transform target;
    void OnDrawGizmosSelected() {
        if (target != null) {
            Gizmos.color = Color.blue;
            Gizmos.DrawLine(transform.position, target.position);
        }
    }
}

结果
Gizmos.DrawLine 调试_第1张图片

你可能感兴趣的:(Unity3d)