public static Il2CppSystem.Type ResolveIl2Cpp(string name, bool throwErrorOnFailure) { System.Type result = System.Type.GetType(name, false); if (result != null) { return(Type.From(result)); } System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies(); foreach (System.Reflection.Assembly eachAssembly in assemblies) { result = eachAssembly.GetType(name, false); if (result != null) { return(Type.From(result)); } } if (throwErrorOnFailure) { throw new System.ArgumentException("Could not resolve type '" + name + "'. Are you missing an assembly?"); } else { return(null); } }
public static T LoadAsset <T>(this AssetBundle assetBundle, string name) where T : UnityEngine.Object { return(assetBundle.LoadAsset(name, Il2CppType.Of <T>())?.Cast <T>()); }
public static bool InheritsFromMonobehaviour(Il2CppSystem.Type type) { return(type.IsSubclassOf(Type.Of <UnityEngine.MonoBehaviour>())); }