Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Changing PostprocessBuildPlayer file doesn't seem to have effect

Discussion in 'iOS and tvOS' started by DiegoSup, Jul 30, 2014.

  1. DiegoSup

    DiegoSup

    Joined:
    Jul 21, 2014
    Posts:
    5
    Hi there!
    I am having a problem building for ios. I wrote a custom script to copy the entitlements file (PostprocessBuildPlayer_Entitlements.py).
    I theory it should be triggered by PostprocessBuildPlayer out of the box; in practice... well, not quite the same.
    In the log editor, after

    Executing PostprocessBuildPlayer...

    I can't see my script. The rights on the file are ok, it is an executable. It is in the same folder and it does work if run by command line.
    At this point i tried to change the PostprocessBuildPlayer file, just to have some debug.
    Surprisingly i added a "print" but i couldn't see any trace of it in the log.
    I tried to write weird stuff to make it crash, but nothing, same result. It seems to take a different file but it is not, i double checked the folders.
    So... any idea how to fix it?
     
  2. DiegoSup

    DiegoSup

    Joined:
    Jul 21, 2014
    Posts:
    5
    So... i found something really weird.
    If i duplicate a working file, copy & paste my code, it works.
    The original file, which doesn't work, has exactly the same permission (755) and same extension arguments (which are none, you can see it with xattr <file>).
    My question now is: what is different then?

    [update]
    I found the problem, it was an EOL within a string that caused an error but the log is silent if you run it from unity.
    FYI you need to run it by the command line then you can see if there is any error while executing sub scripts.
     
    Last edited: Jul 31, 2014
  3. Graham-Dunnett

    Graham-Dunnett

    Unity Technologies

    Joined:
    Jun 2, 2009
    Posts:
    4,287
    Um, I think the script name has to be (exactly) PostprocessBuildPlayer with no extension. Unity will run chmod to add a execute permissions to the user. Also, the docs say the script should be a sh or perl file. (Not saying python won't work, but you'll probably need a shebang.)
     
  4. DiegoSup

    DiegoSup

    Joined:
    Jul 21, 2014
    Posts:
    5
    PostprocessBuildPlayer is perl but Python does work with the script called by it.
    Be careful under OSX because if you edit the file with a text editor is likely to add extra attribute (show them with "ls -l" and there should be a "@" next to the permission flag) that will make it a text file rather than an executable.
    As I said, if the permission are right and still doesn't work, is likely to have an error somewhere but you can't just see the output.