Skip to content

Commit

Permalink
fix: bad selection logic
Browse files Browse the repository at this point in the history
Previously there was a bug where the material was always applied to the first game-object in the hierarchy, instead of the hovered one. Now this is fixed.
  • Loading branch information
ComradeVanti committed Nov 5, 2024
1 parent 15dbcbf commit 8cde10d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Code/ApplyMaterialToAll.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ public static class ApplyMaterialToAll
private static void OnHierarchyGUI(int instanceID, Rect selectionRect)
{
var currentEvent = Event.current;

// Must hold alt
if (!currentEvent.alt) return;

// Must be hovering selection rect
if (!selectionRect.Contains(currentEvent.mousePosition)) return;


// Must only drag single material
if (TryGetDraggedMaterial() is not { } material) return;

Expand Down

0 comments on commit 8cde10d

Please sign in to comment.