Unity Post Process Mayhem


iKriz Avatar

Posted

in

,

by

last modified on


Are you sick and tired of forgetting to copy that data file to the build directory after each and every standalone build in unity? Sure you could incorporate it into the project but you don’t want that, you just wish that PostProcessBuildPlayer script would work on windows. As of Unity 3.5.2 life just got better…

A long awaited function in Unity was a working post process build player script for standalone players on windows as it was already working on mac’s. As seen in the latest Release Notes and stated in the BuildPipeline a few things have changed.. Apparently the PostProscessBuildplayer script is not supported on windows, which is a bummer for windows users on the other hand it’s easily solved with a new and improved UnityEditor.Callbacks which is both usable on Windows and Mac, So here goes…

P.S. No this is not a custom build window script, it actually triggers from the existing Unity BuildWindow.

NB: -10 is a higher priority than 100, the default priority is 1
NB2: This is an Editor Script not something for a gameobject (you should know this)

You can use the method to do all kinds of things on your computer after a build is complete just a couple ideas:

  • After a large build send an email with a link to the file saying the build is complete.
  • Play a sound notifiying you build is complete
  • Run a test on your build
  • And lots more…

Anyway now you have the tools go make 🙂

Comments

9 responses to “Unity Post Process Mayhem”

  1. Anllie Avatar

    very good!

  2. André Avatar

    cool 😉
    thanks.

  3. MikeM Avatar

    How do the post process scripts get executed if you’re compiling from the command line? (i.e. via a Jenkins build) I’m trying to get that working, but they don’t seem to be getting executed.

    1. iKriz Avatar

      To me it sounds like the command line build command doesn’t call the PostProcess Callbacks i could be mistaken havent tested it myself yet.. probably a bug. I’ll give it a go when I have the time 🙂 You can always post a bug report towards the Unity folk i think it’s a valid bug.

  4. […] to write python/perl scripts. Documentation is lacking at this time but you can see an example here. Hopefully Unity will start documenting these features […]

  5. Sameer Avatar

    Hi iKriz,

    If I am to use the above code for a Mac Standalone. What directory would I be writing the files to?

    Regards,
    Sameer

  6. mmerlange Avatar

    Hello,

    Oh this is definitely what I was looking for.
    BUT, I’m such a newby that I don’t even know ho to make it work.
    I naively added your script to a gameObject as a component.
    Tried to build it for ios.
    And I got:”The type or namespace name `UnityEditor’ could not be found. Are you missing a using directive or an assembly reference?”
    Anyone to help?
    Michaël
    PS: I need to have xml files in the Documents folder of the iphone so to make them editable by my app. So using your script to copy them from StreamingAsset to Application.persistentDataPath seems the best option by far

    1. mmerlange Avatar

      ouch for the other dummies, this script must be savec in the Assets/Editor.

      Thanks so much for this script

  7. fffmalzbier Avatar

    Thanks for the // Get Required Paths Section , I was rely stuck on that

    fffmalzbier

Leave a Reply

Your email address will not be published. Required fields are marked *