Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

PluginUtils.cs 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #if SERVICES_SDK_CORE_ENABLED
  2. using System.Collections.Generic;
  3. using UnityEditor;
  4. namespace UnityEngine.Advertisements.Editor
  5. {
  6. static class PluginUtils
  7. {
  8. /// <summary>
  9. /// Contain all GUIDs of Ads DLLs from the Asset Store.
  10. /// </summary>
  11. /// <remarks>
  12. /// Used to verify if the Asset Store package is installed.
  13. /// </remarks>
  14. public static readonly string[] AssetStoreDllGuids =
  15. {
  16. // Android DLL
  17. "cad99f482ce25421196533fe02e6a13e",
  18. // IOS DLL
  19. "d6f3e2ade30154a80a137e0079f66a08",
  20. // Editor DLL
  21. "56921141d53fd4a5888445107b1b1286"
  22. };
  23. public static bool AreAssetStorePluginsInstalled()
  24. => ArePluginsInstalled(AssetStoreDllGuids);
  25. public static bool ArePluginsInstalled(IEnumerable<string> pluginGuids)
  26. {
  27. // if a plugin is not found return false
  28. foreach (var pluginGuid in pluginGuids)
  29. {
  30. if (GetImporterFromGuid<PluginImporter>(pluginGuid) == null)
  31. {
  32. return false;
  33. }
  34. }
  35. return true;
  36. }
  37. static TImporter GetImporterFromGuid<TImporter>(string assetGuid)
  38. where TImporter : AssetImporter
  39. {
  40. var assetPath = AssetDatabase.GUIDToAssetPath(assetGuid);
  41. return AssetImporter.GetAtPath(assetPath) as TImporter;
  42. }
  43. }
  44. }
  45. #endif