本文整理匯總了C#中UnityEngine.Bounds.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Bounds.ToString方法的具體用法?C# Bounds.ToString怎麽用?C# Bounds.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UnityEngine.Bounds
的用法示例。
在下文中一共展示了Bounds.ToString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: RenderBoundsGizmo
static void RenderBoundsGizmo(DrawBoundsGizmo boundsGizmo, GizmoType gizmoType) {
Gizmos.color = boundsGizmo.color;
// get renderer bonding box
var bounds = new Bounds();
var initBound = false;
if (UnityUtility.GetBoundWithChildren(boundsGizmo.transform, ref bounds, ref initBound)) {
if (boundsGizmo.drawCube) {
Gizmos.DrawWireCube(bounds.center, bounds.size);
}
if (boundsGizmo.drawSphere) {
Gizmos.DrawWireSphere(bounds.center, Mathf.Max(Mathf.Max(bounds.extents.x, bounds.extents.y), bounds.extents.z));
}
}
if (boundsGizmo.showCenter) {
Gizmos.DrawLine(new Vector3(bounds.min.x, bounds.center.y, bounds.center.z), new Vector3(bounds.max.x, bounds.center.y, bounds.center.z));
Gizmos.DrawLine(new Vector3(bounds.center.x, bounds.min.y, bounds.center.z), new Vector3(bounds.center.x, bounds.max.y, bounds.center.z));
Gizmos.DrawLine(new Vector3(bounds.center.x, bounds.center.y, bounds.min.z), new Vector3(bounds.center.x, bounds.center.y, bounds.max.z));
}
// UnityEditor code draws a label with the dimensions of the bounding box
Handles.BeginGUI();
var view = SceneView.currentDrawingSceneView;
var pos = view.camera.WorldToScreenPoint(bounds.center);
var size = GUI.skin.label.CalcSize(new GUIContent(bounds.ToString()));
GUI.Label(new Rect(pos.x - (size.x / 2), -pos.y + view.position.height + 4, size.x, size.y), bounds.ToString());
Handles.EndGUI();
}