BuidPostProcessor.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using UnityEngine;
  2. using UnityEditor;
  3. using UnityEditor.Callbacks;
  4. # if UNITY_IOS
  5. using UnityEditor.iOS.Xcode;
  6. #endif
  7. using System.IO;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using TapTap.Common.Editor;
  11. #if UNITY_IOS
  12. public class BuildPostProcessor
  13. {
  14. [PostProcessBuild(999)]
  15. public static void OnPostProcessBuild(BuildTarget buildTarget, string path)
  16. {
  17. if (buildTarget == BuildTarget.iOS)
  18. {
  19. var projPath = TapCommonCompile.GetProjPath(path);
  20. var proj = TapCommonCompile.ParseProjPath(projPath);
  21. var target = TapCommonCompile.GetUnityTarget(proj);
  22. if (TapCommonCompile.CheckTarget(target))
  23. {
  24. Debug.LogError("Unity-iPhone is NUll");
  25. return;
  26. }
  27. if (TapCommonCompile.HandlerIOSSetting(path,
  28. Application.dataPath,
  29. "AntiAdictionResources",
  30. "com.tapsdk.antiaddiction",
  31. "AntiAddiction",
  32. new[] {"AntiAdictionResources.bundle"},
  33. target, projPath, proj))
  34. {
  35. Debug.Log("TapAntiAddiction add Bundle Success!");
  36. return;
  37. }
  38. Debug.LogWarning("TapAntiAddiction add Bundle Failed!");
  39. }
  40. }
  41. }
  42. #endif