Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Editor/Brushes/PrefabBrushes/PrefabBrush/PrefabBrush.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public override void Paint(GridLayout grid, GameObject brushTarget, Vector3Int p
{
var objectsInCell = GetObjectsInCell(grid, brushTarget.transform, position);
var existPrefabObjectInCell = objectsInCell.Any(objectInCell => PrefabUtility.GetCorrespondingObjectFromSource(objectInCell) == m_Prefab);

m_Rotation = Quaternion.Euler(m_Prefab.transform.eulerAngles);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m_Rotation stores the rotation of the brush which can be changed using the rotation hot-keys. This will always override this stored rotation.

We could keep both rotations with the following code:

Suggested change
m_Rotation = Quaternion.Euler(m_Prefab.transform.eulerAngles);
m_Rotation = Quaternion.Euler(m_Prefab.transform.eulerAngles);
Suggested change
m_Rotation = Quaternion.Euler(m_Prefab.transform.eulerAngles);
var rotation = Quaternion.Euler(m_Prefab.transform.eulerAngles) * m_Rotation;
if (!existPrefabObjectInCell)
{
base.InstantiatePrefabInCell(grid, brushTarget, position, m_Prefab, rotation);
}

Would this be better and still suit your use-case?


if (!existPrefabObjectInCell)
{
base.InstantiatePrefabInCell(grid, brushTarget, position, m_Prefab, m_Rotation);
Expand Down