blob: 0c00a869c32663a8a2a610206768d8a13afbc5e8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
using UnityEngine;
public class GuiPixelFix : MonoBehaviour
{
private void LateUpdate()
{
RectTransform rectTransform = base.transform as RectTransform;
if (!(rectTransform.parent == null))
{
Rect rect = (rectTransform.parent as RectTransform).rect;
Vector2 offsetMax = rectTransform.offsetMax;
offsetMax.x = ((rect.width % 2f != 0f) ? 1 : 0);
offsetMax.y = ((rect.height % 2f != 0f) ? 1 : 0);
rectTransform.offsetMax = offsetMax;
}
}
}
|