HeavenStudio/Assets/Scripts/Transform/ForceScaleIdentity.cs

15 lines
414 B
C#
Raw Normal View History

2021-12-19 04:10:43 +00:00
using UnityEngine;
public class ForceScaleIdentity : MonoBehaviour
{
2021-12-25 06:22:09 +00:00
public GameObject parent;
2021-12-19 04:10:43 +00:00
void Update()
{
2021-12-25 06:22:09 +00:00
if (parent == null)
transform.localScale = new Vector3(1f / transform.parent.localScale.x, 1f / transform.parent.localScale.y);
else
transform.localScale = new Vector3(1f / parent.transform.localScale.x, 1f / parent.transform.localScale.y);
2021-12-19 04:10:43 +00:00
}
}