Skip to content

Commit

Permalink
fix: adapt pivot when trying to fit to target
Browse files Browse the repository at this point in the history
When changing target which we want to be unmasked, when previous target had different pivot, it will cause unmasked part to be rendered incorrectly. If we adapt pivot to the new target it will be fixed
  • Loading branch information
mswiszcz authored and mob-sakai committed Oct 7, 2020
1 parent 8a002c7 commit a39fcef
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Assets/Coffee/UIExtensions/UnmaskForUGUI/Scripts/Unmask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public void FitTo(RectTransform target)
{
var rt = transform as RectTransform;

rt.pivot = target.pivot;
rt.position = target.position;
rt.rotation = target.rotation;

Expand Down Expand Up @@ -216,4 +217,4 @@ void SetDirty()
}
}
}
}
}

0 comments on commit a39fcef

Please sign in to comment.