Unity中Gizmos 画线参考

	public	void OnDrawGizmosSelected()
	{
		Gizmos.color = Color.green;
		Gizmos.DrawLine (point1.position, point2.position);
		Gizmos.color = Color.cyan;
		Gizmos.DrawLine (point2.position, point3.position);

		Gizmos.color = Color.red;
		float ratio = 0.25f;
		Gizmos.DrawLine (Vector3.Lerp (point1.position, point2.position, ratio),
	    Vector3.Lerp (point2.position, point3.position, ratio));
	}


此脚本挂在物体上, 当选中该物体的时候画线显示


参考链接

http://www.ceeger.com/Script/MonoBehaviour/MonoBehaviour.OnDrawGizmosSelected.html

你可能感兴趣的:(Unity中Gizmos 画线参考)