Search Unity

PostprocessBuildPlayer Script Help

Discussion in 'Editor & General Support' started by HashbangGames, Aug 13, 2011.

  1. HashbangGames

    HashbangGames

    Joined:
    May 7, 2011
    Posts:
    40
    I am going to try and make this short and simple, and easy to understand.

    I have looked up all the information I possibly can to create a PostprocessBuildPlayer script that will allow me to copy my sqlite database.db file from my root directory of my project into the appropriate place for android devices. I cannot find adequate information pertaining to how to do this 100% correctly.

    Here is where I am currently at:

    STR: ( steps to reproduce )

    1. I created a folder called Editor in my Assets folder. So in my project there is a folder named "Editor"
    2. Inside that folder i have created a file ( no extension ) called "PostprocessBuildPlayer".

    My Database is located in the root of my project. So here is my current version of PostprocessBuildPlayer

    Code (csharp):
    1.  
    2.  
    3. #!/usr/bin/perl
    4. use warnings;
    5. use strict;
    6. use Cwd;
    7. use File::Copy;
    8. use File::Glob 'bsd_glob';
    9. use File::Basename qw(basename dirname fileparse);
    10.  
    11.  
    12. ########################################################################################################################
    13. #                                                                                                                      #
    14. #   PostprocessBuildPlayer - v0.2                                                                                      #
    15. #                                                                                                                      #
    16. #   Revision History:                                                                                                  #
    17. #   2007-NOV-15 : Script updated to v0.2 by Tom Higgins (tom@unity3d.com)                                              #
    18. #                 - Verified compatibility with Unity versions 1.6.2 and 2.x                                           #
    19. #   2007-JUL-05 : Script v0.1 created by Tom Higgins (tom@unity3d.com)                                                 #
    20. #                 - Script written to be compatible with Unity 1.6.2                                                   #
    21. #                                                                                                                      #
    22. ########################################################################################################################
    23.  
    24.  
    25. # Publish Arguments (Do not edit!) #####################################################################################
    26.  
    27. # Unity-Provided Publish Arguments
    28. my $PublishPath =     $ARGV[0];  # The published file (stand-alone, unityweb) path
    29. my $PublishTarget =   $ARGV[1];  # Publish output target (stand-alone, web player, etc.)
    30. my $CompanyName =     $ARGV[3];  # Company name as it appears under Edit > Project Settings > Player
    31. my $ProductName =     $ARGV[4];  # Product name as it appears under Edit > Project Settings > Player
    32. my $DisplayWidth =    $ARGV[5];  # The default display width as it appears under Edit > Project Settings > Player
    33. my $DisplayHeight =   $ARGV[6];  # The default display height as it appears under Edit > Project Settings > Player
    34.  
    35. my $PostProcessPath ="./";
    36.  
    37. # Procedural Code (Do not edit!) #######################################################################################
    38. # Check the current publish target and respond appropriately
    39. if ($PublishTarget eq "android") {
    40.     my $dst = $PublishPath . "/database.db";
    41.     print("Copying Database for android");
    42.     copy($PostProcessPath . "/database.db",$dst) or die "Database file could not be found";
    43. }
    44.  
    45.  
    46.  
    As you can see, I have copied the script used in the "PostprocessBuildPlayer" example located at http://unity3d.com/support/resources/assets/postprocessbuildplayer.html this address.

    I am not sure what i'm doing wrong.

    What i need to know is the following.

    1. my $dst variable , is this the correct path where the database should be stored.
    2. the copy command does that look correct?
    3 is the path for $PostProcessPath does that look correct?

    According to the code should this be working?

    4. How do i debug this?


    If someone could lend me a hand, it would be awesome. I am also willing to pay for support. This is an urgent matter for me.

    Thanks in advance,

    Marco
     
  2. HashbangGames

    HashbangGames

    Joined:
    May 7, 2011
    Posts:
    40
    As an additional note, i am using a windows machine. I have also read that the PostprocessBuildPlayer might not run on a windows machine. Can anyone confirm this?
     
  3. Aeal

    Aeal

    Joined:
    Oct 17, 2010
    Posts:
    19