void LateUpdate() { Vector3 position = m_Transform.position; float labelX = 10f; float labelY = 0f; const float lineSpacing = 14f; IMDraw.LabelShadowed(position, 0f, labelY, m_NameColor, LabelPivot.MIDDLE_CENTER, LabelAlignment.CENTER, "■"); if (m_ShowName) { // Note: Accessing the name on a gameobject generates garbage... IMDraw.LabelShadowed(position, labelX, labelY, m_NameColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, name); labelY += lineSpacing; } if (m_ShowTag) { // Note: Accessing the tag on a gameobject generates garbage... IMDraw.LabelShadowed(position, labelX, labelY, m_TagColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, tag); labelY += lineSpacing; } if (m_ShowPosition) { position.x = (float)Math.Round(position.x, POSITION_ROUNDING_DECIMALS); position.y = (float)Math.Round(position.y, POSITION_ROUNDING_DECIMALS); position.z = (float)Math.Round(position.z, POSITION_ROUNDING_DECIMALS); if (position != m_GameObjectPosition) // Only update the position string when the position has changed, to reduce GC pressure { m_GameObjectPosition = position; m_StringBuilder.Length = 0; m_StringBuilder.Append("xyz : "); m_StringBuilder.Append(position.x); m_StringBuilder.Append(", "); m_StringBuilder.Append(position.y); m_StringBuilder.Append(", "); m_StringBuilder.Append(position.z); m_PositionString = m_StringBuilder.ToString(); } IMDraw.LabelShadowed(position, labelX, labelY, m_TagColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, m_PositionString); labelY += lineSpacing; } if (m_ShowEulerRotation) { Vector3 eulerRotation = m_Transform.rotation.eulerAngles; eulerRotation.x = (float)Math.Round(eulerRotation.x, ROTATION_ROUNDING_DECIMALS); eulerRotation.y = (float)Math.Round(eulerRotation.y, ROTATION_ROUNDING_DECIMALS); eulerRotation.z = (float)Math.Round(eulerRotation.z, ROTATION_ROUNDING_DECIMALS); if (eulerRotation != m_GameObjectEulerRotation) { m_GameObjectEulerRotation = eulerRotation; m_StringBuilder.Length = 0; m_StringBuilder.Append("deg : "); m_StringBuilder.Append(eulerRotation.x); m_StringBuilder.Append(", "); m_StringBuilder.Append(eulerRotation.y); m_StringBuilder.Append(", "); m_StringBuilder.Append(eulerRotation.z); m_RotationString = m_StringBuilder.ToString(); } IMDraw.LabelShadowed(position, labelX, labelY, m_TagColor, LabelPivot.MIDDLE_LEFT, LabelAlignment.LEFT, m_RotationString); labelY += lineSpacing; } if (m_ShowRendererBounds && m_Renderers != null && m_Renderers.Count > 0) { for (int i = 0; i < m_Renderers.Count; ++i) { if (m_Renderers[i] != null) { IMDraw.Bounds(m_Renderers[i], m_BoundsColor); } } } if (m_ShowWireframeColliders && m_Colliders != null && m_Colliders.Count > 0) { for (int i = 0; i < m_Colliders.Count; ++i) { if (m_Colliders[i] != null) { IMDraw.Collider(m_Colliders[i], m_ColliderColor, m_ColliderScaleOffset, m_ShowSolidColliders); } } } }