PostbuildSendProjectState.cs 947 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using SingularityGroup.HotReload.Editor.Cli;
  3. using UnityEditor;
  4. using UnityEditor.Build;
  5. namespace SingularityGroup.HotReload.Editor {
  6. #pragma warning disable CS0618
  7. class PostbuildSendProjectState : IPostprocessBuild {
  8. #pragma warning restore CS0618
  9. public int callbackOrder => 9999;
  10. public void OnPostprocessBuild(BuildTarget target, string path) {
  11. try {
  12. if (!HotReloadBuildHelper.IncludeInThisBuild()) {
  13. return;
  14. }
  15. // after build passes, need to send again because EditorApplication.delayCall isn't called.
  16. var buildInfo = BuildInfoHelper.GenerateBuildInfoMainThread();
  17. HotReloadCli.PrepareBuildInfo(buildInfo);
  18. } catch (BuildFailedException) {
  19. throw;
  20. } catch (Exception e) {
  21. throw new BuildFailedException(e);
  22. }
  23. }
  24. }
  25. }