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

Project path from command line doesn't always switch

Discussion in 'Editor & General Support' started by FodderMK, Jun 16, 2014.

  1. FodderMK

    FodderMK

    Joined:
    Jan 21, 2013
    Posts:
    5
    I have set up Jenkins to build our Unity projects. It takes the project from git and builds Windows and Web simultaneously. I use seperate project folders for each build type so that Unity doesn't trip over itself when compiling. 99.9% of the time this works just fine, and I see log files that look like the following:

    Code (csharp):
    1.  BATCHMODE ARGUMENTS:
    2. C:\Program Files (x86)\Unity-4.5\Editor\Unity.exe
    3. -projectPath
    4. C:\Jenkins\jobs\unity-web\workspace
    5. -quit
    6. -batchmode
    7. -nographics
    8. -logFile
    9. C:\Jenkins\jobs\unity-web\workspace\bin\build.log
    10. -buildWebPlayer
    11. C:\Jenkins\jobs\unity-web\workspace\bin\my-game
    12. Successfully changed project path to: C:\Jenkins\jobs\unity-web\workspace
    13. C:/Jenkins/jobs/unity-web/workspace
    0.1% of the time it doesn't work:

    Code (csharp):
    1.  BATCHMODE ARGUMENTS:
    2. C:\Program Files (x86)\Unity-4.5\Editor\Unity.exe
    3. -projectPath
    4. C:\Jenkins\jobs\unity-web\workspace
    5. -quit
    6. -batchmode
    7. -nographics
    8. -logFile
    9. C:\Jenkins\jobs\unity-web\workspace\bin\build.log
    10. -buildWebPlayer
    11. C:\Jenkins\jobs\unity-web\workspace\bin\my-game
    12. Successfully changed project path to: C:\Jenkins\jobs\unity-web\workspace
    13. C:/Jenkins/jobs/unity-windows/workspace
    The important parts are on lines 11 - 13. Even though I have specified a project path of "unity-web\workspace" and Unity reports it has successfully changed the project path to "unity-web\workspace" it then reports it is using "unity-windows\workspace". I know this is a problem because my Windows build process shows the following:

    Code (csharp):
    1.  BATCHMODE ARGUMENTS:
    2. C:\Program Files (x86)\Unity-4.5\Editor\Unity.exe
    3. -projectPath
    4. C:\Jenkins\jobs\unity-windows\workspace
    5. -quit
    6. -batchmode
    7. -nographics
    8. -logFile
    9. C:\Jenkins\jobs\unity-windows\workspace\bin\build.log
    10. -buildWindowsPlayer
    11. C:\Jenkins\jobs\unity-windows\workspace\bin\my-game.exe
    12. Successfully changed project path to: C:\Jenkins\jobs\unity-windows\workspace
    13. C:/Jenkins/jobs/unity-windows/workspace
    14. It looks like another Unity instance is running with this project open.
    15.  
    16. Multiple Unity instances cannot open the same project.
    17.  
    18. Project: C:/Jenkins/jobs/unity-windows/workspace
    19.  
    20. (Filename: C:/BuildAgent/work/d63dfc6385190b60/Editor/Src/Application.cpp Line: 251)
    21.  
    22.  
    23. Aborting batchmode due to failure:
    24. Fatal error! It looks like another Unity instance is running with this project open.
    25.  
    26. Multiple Unity instances cannot open the same project.
    27.  
    28. Project: C:/Jenkins/jobs/unity-windows/workspace
    Why does Unity occasionally use the wrong project path and how can I force it to always use the correct one?
     
    tigerleapgorge likes this.
  2. shaderop

    shaderop

    Joined:
    Nov 24, 2010
    Posts:
    942
    I'm guessing that concurrently launching multiple batch mode instances of Unity isn't a common use case, so it could very well be a bug that no one has managed to notice until now. Might be worth reporting it.
     
  3. FodderMK

    FodderMK

    Joined:
    Jan 21, 2013
    Posts:
    5
    Issue created. Interestingly, I have encountered the problem even when I use two different instances of Unity installations (on the same machine)

    Job 1 (works)

    Code (csharp):
    1. BATCHMODE ARGUMENTS:
    2. C:\Program Files (x86)\Unity-4.5-Web\Editor\Unity.exe
    3. -projectPath
    4. C:\Jenkins\jobs\unity-web\workspace
    5. -quit
    6. -batchmode
    7. -nographics
    8. -logFile
    9. C:\Jenkins\jobs\unity-web\workspace\bin\build.log
    10. -buildWebPlayer
    11. C:\Jenkins\jobs\unity-web\workspace\bin\my-game
    12. Successfully changed project path to: C:\Jenkins\jobs\unity-web\workspace
    13. C:\Jenkins\jobs\unity-web\workspace

    Job 2 (fails)

    Code (csharp):
    1. BATCHMODE ARGUMENTS:
    2. C:\Program Files (x86)\Unity-4.5\Editor\Unity.exe
    3. -projectPath
    4. C:\Jenkins\jobs\unity-windows\workspace
    5. -quit
    6. -batchmode
    7. -nographics
    8. -logFile
    9. C:\Jenkins\jobs\unity-windows\workspace\bin\build.log
    10. -buildWindowsPlayer
    11. C:\Jenkins\jobs\unity-windows\workspace\bin\my-game.exe
    12. Successfully changed project path to: C:\Jenkins\jobs\unity-windows\workspace
    13. C:\Jenkins\jobs\unity-web\workspace
    14. It looks like another Unity instance is running with this project open.
    15.  
    16. Multiple Unity instances cannot open the same project.
     
    Last edited: Jun 21, 2014
  4. danw_unity

    danw_unity

    Unity Technologies

    Joined:
    Oct 16, 2014
    Posts:
    27
    This issue was fixed in Unity 4.6.2p1.
     
  5. SebaLagos

    SebaLagos

    Joined:
    Apr 13, 2017
    Posts:
    1
    I'm actually having this same issue, but with unity 2017.3.1p1 and can't find why this is happening

    Code (Boo):
    1. COMMAND LINE ARGUMENTS:
    2. /Applications/Unity 2017.3.1p1/Unity.app/Contents/MacOS/Unity
    3. -quit
    4. -batchmode
    5. -nographics
    6. -logFile
    7. /Users/Shared/Jenkins/Home/workspace/Game/Builds/Staging/Artifacts/270/buildLog.log
    8. -projectPath
    9. /Users/Shared/Jenkins/Home/workspace/Game/Builds/Staging/LocalRepo/Unity
    10. -buildTarget
    11. iOS
    12. -executeMethod
    13. BuildScript.BatchBuild
    14. +buildPath
    15. /Users/Shared/Jenkins/Home/workspace/Game/Builds/Staging/
    16. +buildPlatform
    17. iOS
    18. +buildEnv
    19. Staging
    20. /Users/Shared/Jenkins/Home/workspace/Game/Builds/Production/LocalRepo/Unity
    This is a OSX env
     
  6. cerberusinteractivebuild

    cerberusinteractivebuild

    Joined:
    Jun 7, 2018
    Posts:
    1
    Did you resolve this?
     
  7. yamoinca

    yamoinca

    Joined:
    Jun 1, 2013
    Posts:
    7
    I appear to be having similar issue using unity 2020.3.24f1 on Windows platform.
    I started work in one workspace, then switched to another and afaik things were working as expected.
    But then when I switched back to the first things were getting mixed up.
    Now switching to the second (which had been working) is also broken (I can see for example, that the shader compiler is referencing files in the first workspace).