YiYanPackageSettings.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Reflection;
  5. using UnityEditor;
  6. using UnityEngine;
  7. using UnityEngine.XR;
  8. using UnityEditor.PackageManager;
  9. using UnityEditor.PackageManager.Requests;
  10. public class YiYanPackageSettings
  11. {
  12. [MenuItem("GHZ/GHZXRPackage/YiYanPackage")]
  13. public static void YiYanPackageInit()
  14. {
  15. Debug.Log("YiYanPackageInit");
  16. PlayerSet();
  17. }
  18. static void PlayerSet()
  19. {
  20. try
  21. {
  22. FileUtil.DeleteFileOrDirectory("Assets/YiYanPackage");
  23. }
  24. catch
  25. {
  26. }
  27. string[] strlist = new string[1];
  28. strlist[0] = "https://gogs.ghz-tech.com:8843/GHzUnityModel/YiYanXR.git";
  29. AddAndRemoveRequest rest = Client.AddAndRemove(strlist);
  30. while (!rest.IsCompleted)
  31. {
  32. Debug.Log("正在加载插件包:" + rest.Status.ToString());
  33. System.Threading.Thread.Sleep(500);
  34. // 等待PackageManager请求完成
  35. }
  36. // Client.Add("com.unity.xr.openxr");
  37. // ListRequest request = Client.List(true);
  38. // LoadSamplesSettings.PlayerYiTanSamplesSet(request);
  39. }
  40. }