internal static string[] BuildExportPackageAssetListGuids(string[] guids, bool dependencies) { List <string> methods = new List <string> { "UnityEditor.PackageUtility.BuildExportPackageItemsList", "UnityEditor.AssetServer.BuildExportPackageAssetListAssetsItems" }; MethodInfo methodInfo = BackwardsCompatibilityUtility.GetMethodInfo(methods, new Type[] { typeof(string[]), typeof(bool) }); object[] parameters = new object[] { guids, dependencies }; object[] array = (object[])methodInfo.Invoke(null, parameters); string[] array2 = new string[array.Length]; FieldInfo field = methodInfo.ReturnType.GetElementType().GetField("guid"); for (int i = 0; i < array.Length; i++) { string text = (string)field.GetValue(array[i]); array2[i] = text; } return(array2); }
public static Type FindTypeByName(string name) { if (BackwardsCompatibilityUtility.m_TypeCache.ContainsKey(name)) { return(BackwardsCompatibilityUtility.m_TypeCache[name]); } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (BackwardsCompatibilityUtility.AllowLookupForAssembly(assembly.FullName)) { try { Type[] types = assembly.GetTypes(); foreach (Type type in types) { if (type.FullName == name) { BackwardsCompatibilityUtility.m_TypeCache[type.FullName] = type; return(type); } } } catch (Exception ex) { throw new InvalidOperationException(string.Format("Count not fetch list of types from assembly {0} due to error: {1}", assembly.FullName, ex.Message)); } } } return(null); }
internal static string[] CollectAllChildren(string guid, string[] collection) { List <string> methods = new List <string> { "UnityEditor.AssetDatabase.CollectAllChildren", "UnityEditor.AssetServer.CollectAllChildren" }; return((string[])BackwardsCompatibilityUtility.TryStaticInvoke(methods, new object[] { guid, collection })); }
internal static void ExportPackage(string[] guids, string fileName, bool needsPackageManagerManifest) { List <string> list = new List <string>(); if (needsPackageManagerManifest) { list.Add("UnityEditor.PackageUtility.ExportPackageAndPackageManagerManifest"); } list.Add("UnityEditor.PackageUtility.ExportPackage"); list.Add("UnityEditor.AssetServer.ExportPackage"); object[] parameters = new object[] { guids, fileName }; BackwardsCompatibilityUtility.TryStaticInvoke(list, parameters); }
public AssetBundleCreateRequest LoadFromMemoryAsync(byte[] bytes) { List <string> methods = new List <string> { "UnityEngine.AssetBundle.LoadFromMemoryAsync", "UnityEngine.AssetBundle.CreateFromMemory" }; MethodInfo methodInfo = BackwardsCompatibilityUtility.GetMethodInfo(methods, new System.Type[] { typeof(byte[]) }); return((AssetBundleCreateRequest)methodInfo.Invoke(null, new object[] { bytes })); }
public static object TryStaticInvoke(List <string> methods, object[] parameters) { MethodInfo methodInfo = BackwardsCompatibilityUtility.GetMethodInfo(methods, null); return(methodInfo.Invoke(null, parameters)); }