using UnityEngine; namespace Unheimlich.Utility { public static class UnityExtensions { public static void SafeInvoke(this System.Action action) { action?.Invoke(); } public static void SafeInvoke(this System.Action action, T arg) { action?.Invoke(arg); } public static Color WithAlpha(this Color color, float alpha) { color.a = alpha; return color; } public static Vector3 WithY(this Vector3 vector, float y) { vector.y = y; return vector; } public static Vector3 WithX(this Vector3 vector, float x) { vector.x = x; return vector; } public static Vector3 WithZ(this Vector3 vector, float z) { vector.z = z; return vector; } public static void CancelAllTweens(this GameObject gameObject) { if (gameObject != null) LeanTween.cancel(gameObject); } } }