I am attempting to run the unity editor in batchmode from a python script in order to import and bundle assets automatically. I am running into a very early problem though. I use the command line to create a temporary project, the arguments are as follows...
['C:\Program Files (x86)\Unity\Editor\Unity.exe', '-quit', '-batchmode', '-nographics', '-createProject c:\build\GAM\Vehicles\Cars\WW\05TennisCLK\SrcAsset\unityBuilder']
It runs for a while and then aborts with the complaint that Multiple Unity Instances can't open the same project. It then identifies an older project with the same name (but different path) as being the root of the issue.
I have verified the following
1) In process explorer throughout the entire scripts execution only 1 unity process is running.
2) The old project has been deleted and no longer exists.
3) I restarted the machine in case unity had a handle to an old file of some sort.
4) I have tried both pre-creating the path for the temporary project, and ensuring that it doesn't exist, I get the same result regardless.
The part of the python script that is running is very simple, it just executes this command line and then exits.
I was wondering had anyone else experienced this message being generated, apparently erroneously and if so how did they resolve it?
asked Jun 14 '10 at 11:30 AM
Having spent some time looking at this, I have found the error was to do with how the string for the project location is passed in python to the subprocess module. Essentially you need to make sure it gets passed as a string not a list item, and that it does not have quotes around it. It seems that these specifications vary between operating systems (as this is essentially a path issue that makes sense), so for future reference I am using winXP 64.
Whilst working with this problem I also got an error about changing the working directory to apparently an identical path. This turned out to be because I had a path with mixed slash and double slash i.e. "c:\folder1\folder2\folder3\file.ext" changing the double slash to a single slash resolved this issue.
answered Jun 15 '10 at 08:10 AM