From 4deff1b1a148fd19a10a6da389f6c05e8731f1eb Mon Sep 17 00:00:00 2001 From: cryy22 <116713472+cryy22@users.noreply.github.com> Date: Mon, 22 Apr 2024 20:34:49 -0700 Subject: [PATCH] fix unit UI showing up above promotion chooser etc --- Runtime/Helpers/LocalSpaceConverter.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Runtime/Helpers/LocalSpaceConverter.cs b/Runtime/Helpers/LocalSpaceConverter.cs index 590c5d5..a1a0efd 100644 --- a/Runtime/Helpers/LocalSpaceConverter.cs +++ b/Runtime/Helpers/LocalSpaceConverter.cs @@ -21,6 +21,15 @@ public static Vector3 ConvertScale(Transform from, Transform to, Vector3 scale) return to.InverseTransformVector(from.TransformVector(scale)); } + public static Vector3 LocalScaleForGlobalUnity(Transform transform) + { + return new Vector3( + x: transform.localScale.x / transform.lossyScale.x, + y: transform.localScale.y / transform.lossyScale.y, + z: transform.localScale.z / transform.lossyScale.z + ); + } + public static void SetGlobalScale(this Transform transform, Vector3 globalScale) { transform.localScale = Vector3.one;