- Home /
BuildPipeline.BuildPlayer misnames .pbxuser file
I'm trying to put together an automated build process for our project and I'm running into a total show-stopper.
When I attempt to build, the process started by the BuildPlayer method exits with the following error message...
Error building Player: FileNotFoundException: Could not find file "/Users/jeff/Public/CruiseControl/projects//Temp/StagingArea/iPhone-Trampoline/Unity-iPhone.xcodeproj/jeff.pbxuser".
I executed the command line build function from inside the unity editor so that it wouldn't delete the Temp folder after throwing the error and dug into it to try and figure out why I was getting the above error.
Inside the xcode project "file" (directory so far as my terminal cares) I found the file "user.pbxuser".
So...unity is mis-naming the pbxuser file for some reason.
Does anyone know why Unity is doing this?
We're still using Unity 3.4 if that makes a difference. This is all done on a Mac running Snow Leopard.
I tried creating a new project just to test our build process after a number of new errors cropped up that consists of nothing more than an empty scene and a basic command line build script. It still gives me this error.
I've checked the project settings and I can't find anything that would change the name of the offending pbxuser file from user to something else.
Is this a Unity bug? Are we just hosed (we can't upgrade to 3.5 this late in development. It's just not an option).
This is the code that fails.
string err = null; try { err = BuildPipeline.BuildPlayer(Get$$anonymous$$obileScenes(), GetIOSBuildPath(), BuildTarget.iPhone, BuildOptions.AcceptExternal$$anonymous$$odificationsToPlayer); } catch (System.Exception ex) { Log("We encountered an error:\n" + ex.ToString()); }
if (err != null) WriteError$$anonymous$$essage(err);
Get $$anonymous$$obile Scenes() retrieves a list of scenes from a file and returns a string array. Get IOSBuild Path does the same thing. Log is a function I wrote to replace Debug.Log because this method is ment to be called from the command line and Debug.Log is worthless without the editor running.
When I build from the Editor, the xcode project has a file named jeff.pbxuser.
What am I not setting in code that tells unity to name the pbxuser file after me ins$$anonymous$$d of what has to be the default user.pbxuser? I've been combing through the documentation for everything I can find related to the build pipeline and I can't find anything relevant.
Answer by jyurkiw · Apr 10, 2012 at 08:35 PM
I changed BuildOptions.AcceptExternalModificationsToPlayer to BuildOptions.None and no more error.
I don't know why.
Figured out why.
BuildOptions.AcceptExternal$$anonymous$$odificationToPlayer requires a previously built project to be present. It's effectively the same as BuildOptions.None, except it will preserve any changes you made to the xcode project since the last time the build was run.
However, if you pass BuildPlayer AcceptExternal$$anonymous$$odificationToPlayer when there is no previous project build present at the path you supply, it will incorrectly default the username to User when creating the initial .pbxuser file.
Therefore, you need to set your BuildOption to None for the first build. After that you can use AcceptExternal$$anonymous$$odificationToPlayer and it won't error.
Completely insane stuff. Thanks for sharing all your findings! I was having this issue even without using BuildPipeline
or any editor scripts whatsoever. :-o
Answer by olivierva · May 24, 2013 at 09:41 AM
If you start Unity in a terminal like this: USER=user open /Applications/Unity/Unity.app the file generated will be: user.pbxuser (it overrides your Unix user name)
if everyone who works on the project does this you can append your iOS build because everyone has the same naming of the pbxuser file.
This worked for me, thank you very much olivierva! :)
Answer by rutter · Apr 07, 2012 at 01:48 AM
I've seen the same problem a few times.
Possible solutions:
I found those pages off of google and tried everything. Temp is being deleted like it should so that's not it. I tried exporting the entire project and that didn't do anything but eat more disk space. I even tried reimporting everything in-editor as well as restarting the entire computer just to make sure I restarted Unity.
Nothing.
The project is currently trying to build based off of my original SVN checkout location ins$$anonymous$$d of the copy I made to work with CruiseControl. If that works I'll post about it here, but with over 8 gigs of project data I won't know until tomorrow.
The only thing you've missed here, jyurkiw, is updating the wiki with your solution. It's ok, I've done it for you. ;-)
Your answer
Follow this Question
Related Questions
Simultaneous Android and iOS development 1 Answer
iPhone Virtual Reality App won't load onto my phone. 0 Answers
Mini Mac - Can this Compile Unity? 2 Answers
xCode Errors 1 Answer
Can I build for iphone in a Windows PC? 3 Answers