Search Unity

How to fail asset bundle builds

Discussion in 'Asset Bundles' started by liortal, Jul 31, 2019.

  1. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,259
    We have a [PostProcessScene] method that verifies some conditions on the scene as it gets built into an asset bundle / player.

    I would like to be able to fail that build in case those conditions are not met. so far, i haven't been able to find anything useful.

    Tried throwing exceptions of different sorts (System.Exception, BuildFailedException) but no luck.

    The last resort i have is to just kill the Unity editor (Application.Quit or something similar), this will (sort of?) work while running in our CI environment, but i am looking for a nicer solution.
     
  2. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,259
    ping. anyone? maybe @superpig the build meister ?
     
    Last edited: Oct 10, 2019
  3. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    249
    What Unity version? Throwing BuildFailedException should work, though there was an issue with that not failing a build that was fixed a few months ago and backported.
     
  4. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,259
    We are using Unity 2018.4
     
  5. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,259
  6. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,259
    Attaching my simple project. I am using 2018.4.0 and the build does not fail.
    Also tried with 2018.4.1 and it behaves the same (build will not fail when throwing this exception).
     

    Attached Files:

    Last edited: Oct 11, 2019
  7. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    249
    It's definitely possible I missed an edge case in my fix. There is a lot of indirection in those callbacks that I'd love to kill someday. Mind submitting your repro through the bug reporter so it's tracked properly? Post the case # here so I can pull it immediately
     
  8. liortal

    liortal

    Joined:
    Oct 17, 2012
    Posts:
    3,259
    @Ryanc_unity There you go: (Case 1191481) BuildFailedException doesn't fail build from PostProcessScene callback
     
  9. Ryanc_unity

    Ryanc_unity

    Unity Technologies

    Joined:
    Jul 22, 2015
    Posts:
    249