Skip to content

Unexpected behavior on folders with no projects #222

Open
@mio-moto

Description

@mio-moto

I was debugging today a problem with our CI environment on my development machine and noticed a strange bug where the Editor was upgrading randomly, not noticing that my terminal went back to my home folder.

PS C:\Users\mio> Start-UnityEditor -Wait -LogFile build.txt -AdditionalArguments " -buildPlatform Desktop -buildOutput $PWD\Build -buildTarget Win64 "  -ExecuteMethod BuildTools.Pipeline.StartCommandLineBuild -Batchmode -WhatIf
What if: Performing the operation "System.Diagnostics.Process.Start()" on target "C:\Program Files\Unity\Hub\Editor\2020.2.1f1\Editor\Unity.exe -executeMethod BuildTools.Pipeline.StartCommandLineBuild -logFile build.txt -batchmode  -buildPlatform Desktop -buildOutput C:\Users\mio\Build -buildTarget Win64 ".

That is no bug per-se, the command line utility selects the latest editor (due to the missing ProjectVersion.txt). However, the editor still executes fine - because Unity does store the last opened project somewhere (I'm guessing either by registry key or somewhere in LocalAppData), and opens that.

Start-UnityEditor falls back to the latest version, starts the Editor, which then opens the last opened project, no matter which ProjectVersion.txt.

Reproduction

Execute Start-UnityEditor in a folder that does not contain a Unity project

Possible Solutions

Start-UnityEditor should either be able to find the folder that Unity is going to open or exit prematurely with an error code that this folder is not a Unity project folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions