Search Unity

Pre/Post-Export, Pre/Post-Build Scripts and Addressable/Asset Bundle Builds

Discussion in 'Unity Build Automation' started by james7132, Nov 6, 2019.

  1. james7132

    james7132

    Joined:
    Mar 6, 2015
    Posts:
    166
    What's the ordering of when the user defined scripts are called and when Addressables and Asset Bundle builds are done? I would like to add a hook to fetch additional data to be baked into an Addressables build before those assets are built.
     
  2. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    It goes like this:
    1. Pre-build scripts (run outside of Unity, before Unity CLI execution)
    2. Pre-export method
    3. Build Addressables
    4. Build Player
    5. Post-export method (executes only if build succeeded, does not execute if Addressables-only build was run... which is probably a bug that I'll add to the backlog)
    6. Post-build scripts (again, run outside of Unity)
     
  3. severin1212

    severin1212

    Joined:
    May 18, 2020
    Posts:
    29
    so post build scripts work even if it's an addressables only build?
     
  4. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    Post-build scripts (shell scripting, ruby etc) do work however post-EXPORT scripts as you referenced in your other post do not. I wrote the fix for this however so this will be resolved soon.
     
  5. severin1212

    severin1212

    Joined:
    May 18, 2020
    Posts:
    29
    post process build code in C# didn't work neither , I just took made a custom addressable build script where I added my s3 upload code within the last try catch, so that if my upload makes errors, the addressable build fails and it doesn't upload broken or missing content.
    even if you fix post export Code , it won't avoid these issues to happen, like not uploading all the bundles or any misbehaviour, it is more advantegeous if you add to addressables some part where we can post addressable build code that will also be supervised if it fails.
    Thanks anyway
     
  6. victorw

    victorw

    Joined:
    Sep 14, 2016
    Posts:
    459
    Post process build code will never work because content builds are completely separate from the Unity player build which is targeted by post process build scripts.