Skip to content

Commit a67c93e

Browse files
Stop spamming Look Rotation log when holding shift (#653)
* Stop spamming LookRotation log * Add changelog entry * Fix changelog entry * Improve zero magnitude check and apply fix to other instance * Move fix in UpdatePlaneRotation() method
1 parent 8bebc56 commit a67c93e

2 files changed

Lines changed: 14 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
66
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
77

8+
## Unreleased
9+
10+
### Fixed
11+
12+
- [UUM-133861] Fixed "Look rotation viewing vector is zero" log being spammed when holding shift while using a create tool such as Create Sprite.
13+
814
## [6.0.9] - 2026-01-30
915

1016
### Fixed

Editor/EditorCore/DrawShapeTool.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,11 @@ internal void SetBounds(Vector3 size)
844844
m_BB_HeightCorner = m_BB_Origin + size;
845845
}
846846

847+
void UpdatePlaneRotation()
848+
{
849+
m_PlaneRotation = Mathf.Approximately(m_PlaneForward.sqrMagnitude, 0f) ? Quaternion.identity : Quaternion.LookRotation(m_PlaneForward, m_Plane.normal);
850+
}
851+
847852
internal void DoDuplicateShapePreviewHandle(Vector3 position)
848853
{
849854
var evt = Event.current;
@@ -868,7 +873,7 @@ internal void DoDuplicateShapePreviewHandle(Vector3 position)
868873

869874
m_Bounds.center = cornerPosition + new Vector3(size.x / 2f, 0, size.z / 2f) + (size.y / 2f) * m_Plane.normal;
870875
var lastPreviewRotation = m_PlaneRotation;
871-
m_PlaneRotation = Quaternion.LookRotation(m_PlaneForward, m_Plane.normal);
876+
UpdatePlaneRotation();
872877
var forceRebuildPreview = !m_PlaneRotation.Equals(lastPreviewRotation) ||
873878
m_LastPreviewPivotLocation != pivotLocation;
874879
m_LastPreviewPivotLocation = pivotLocation;
@@ -919,7 +924,7 @@ internal void DoDuplicateShapePreviewHandle(Vector3 position)
919924
pivot += .5f * size.y * m_Plane.normal;
920925
else
921926
pivot = previewPivotPosition;
922-
m_DuplicateGO.transform.SetPositionAndRotation(pivot, Quaternion.LookRotation(m_PlaneForward, m_Plane.normal));
927+
m_DuplicateGO.transform.SetPositionAndRotation(pivot, m_PlaneRotation);
923928

924929
DrawBoundingBox(preview_BB_Origin, preview_BB_HeightCorner, preview_BB_OppositeCorner, false);
925930
}
@@ -943,7 +948,7 @@ void RecalculateBounds()
943948
if(Mathf.Abs(m_Bounds.center.y) < 0.0001f)
944949
m_Bounds.center = m_Bounds.center + 0.0001f * Vector3.up;
945950

946-
m_PlaneRotation = Quaternion.LookRotation(m_PlaneForward,m_Plane.normal);
951+
UpdatePlaneRotation();
947952
}
948953

949954
internal void RebuildShape()

0 commit comments

Comments
 (0)