Skip to content

Commit

Permalink
-Assign brushTarget GridLayout only if it exists (#304)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChuanXin-Unity authored Sep 10, 2021
1 parent c4e0b7d commit e27d208
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Editor/Brushes/GameObjectBrush/GameObjectBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,11 @@ private void GetGrid(ref GridLayout gridLayout, ref GameObject brushTarget)
if (brushTarget == hiddenGrid)
brushTarget = null;
if (brushTarget != null)
gridLayout = brushTarget.GetComponent<GridLayout>();
{
var targetGridLayout = brushTarget.GetComponent<GridLayout>();
if (targetGridLayout != null)
gridLayout = targetGridLayout;
}
}

/// <summary>Clears all data of the brush.</summary>
Expand Down

0 comments on commit e27d208

Please sign in to comment.