コード例 #1
0
    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);
    }
コード例 #2
0
        public bool LoggedIn()
        {
            Type         type     = BackwardsCompatibilityUtility.FindTypeByName("UnityEditor.Connect.UnityConnect");
            PropertyInfo property = type.GetProperty("loggedIn");

            UnityConnectSession.s_LoggedIn = (bool)property.GetValue(UnityConnectSession.GetUnityConnectInstance(), null);
            return(UnityConnectSession.s_LoggedIn);
        }
コード例 #3
0
 private static object GetUnityConnectInstance()
 {
     if (UnityConnectSession.s_UnityConnectInstance == null)
     {
         Type type = BackwardsCompatibilityUtility.FindTypeByName("UnityEditor.Connect.UnityConnect");
         UnityConnectSession.s_UnityConnectInstance = type.GetProperty("instance").GetValue(null, null);
     }
     return(UnityConnectSession.s_UnityConnectInstance);
 }
コード例 #4
0
    internal static string[] CollectAllChildren(string guid, string[] collection)
    {
        List <string> strs = new List <string>()
        {
            "UnityEditor.AssetDatabase.CollectAllChildren",
            "UnityEditor.AssetServer.CollectAllChildren"
        };

        return((string[])BackwardsCompatibilityUtility.TryStaticInvoke(strs, new object[] { guid, collection }));
    }
コード例 #5
0
 public string GetAccessToken()
 {
     if (string.IsNullOrEmpty(UnityConnectSession.s_AccessToken))
     {
         Type       type   = BackwardsCompatibilityUtility.FindTypeByName("UnityEditor.Connect.UnityConnect");
         MethodInfo method = type.GetMethod("GetAccessToken");
         UnityConnectSession.s_AccessToken = (string)method.Invoke(UnityConnectSession.GetUnityConnectInstance(), null);
     }
     return(UnityConnectSession.s_AccessToken);
 }
コード例 #6
0
    public AssetBundleCreateRequest LoadFromMemoryAsync(byte[] bytes)
    {
        List <string> strs = new List <string>()
        {
            "UnityEngine.AssetBundle.LoadFromMemoryAsync",
            "UnityEngine.AssetBundle.CreateFromMemory"
        };
        MethodInfo methodInfo = BackwardsCompatibilityUtility.GetMethodInfo(strs, new Type[] { typeof(byte[]) });

        return((AssetBundleCreateRequest)methodInfo.Invoke(null, new object[] { bytes }));
    }
コード例 #7
0
    internal static void ExportPackage(string[] guids, string fileName, bool needsPackageManagerManifest)
    {
        List <string> strs = new List <string>();

        if (needsPackageManagerManifest)
        {
            strs.Add("UnityEditor.PackageUtility.ExportPackageAndPackageManagerManifest");
        }

        strs.Add("UnityEditor.PackageUtility.ExportPackage");
        strs.Add("UnityEditor.AssetServer.ExportPackage");
        BackwardsCompatibilityUtility.TryStaticInvoke(strs, new object[] { guids, fileName });
    }
コード例 #8
0
    internal static void ExportPackage(string[] guids, string fileName)
    {
        List <string> methods = new List <string>
        {
            "UnityEditor.PackageUtility.ExportPackage",
            "UnityEditor.AssetServer.ExportPackage"
        };

        object[] parameters = new object[]
        {
            guids,
            fileName
        };
        BackwardsCompatibilityUtility.TryStaticInvoke(methods, parameters);
    }
コード例 #9
0
    internal static string[] BuildExportPackageAssetListGuids(string[] guids, bool dependencies)
    {
        List <string> strs = new List <string>()
        {
            "UnityEditor.PackageUtility.BuildExportPackageItemsList",
            "UnityEditor.AssetServer.BuildExportPackageAssetListAssetsItems"
        };
        MethodInfo methodInfo = BackwardsCompatibilityUtility.GetMethodInfo(strs, new Type[] { typeof(string[]), typeof(bool) });

        object[]  objArray  = (object[])methodInfo.Invoke(null, new object[] { guids, dependencies });
        string[]  strArrays = new string[(int)objArray.Length];
        FieldInfo field     = methodInfo.ReturnType.GetElementType().GetField("guid");

        for (int i = 0; i < (int)objArray.Length; i++)
        {
            string value = (string)field.GetValue(objArray[i]);
            strArrays[i] = value;
        }

        return(strArrays);
    }
コード例 #10
0
 public static object TryStaticInvoke(List <string> methods, object[] parameters)
 {
     return(BackwardsCompatibilityUtility.GetMethodInfo(methods, null).Invoke(null, parameters));
 }