Firstborn/Library/PackageCache/com.unity.ads@4.4.2/Runtime/Advertisement/Utilities/EnumUtilities.cs

16 lines
510 B
C#
Raw Normal View History

2023-03-28 13:24:16 -04:00
using System;
namespace UnityEngine.Advertisements.Utilities {
public static class EnumUtilities {
public static T GetEnumFromAndroidJavaObject<T>(AndroidJavaObject androidJavaObject, T defaultValue) {
try {
return (T) Enum.Parse(typeof(T), androidJavaObject.Call<string>("toString"), true);
} catch (Exception) {
Debug.LogError("Unable to map native enum to managed enum");
}
return defaultValue;
}
}
}