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

Specify build output path (via command line or edit project settings files)

Discussion in 'Editor & General Support' started by YiHan-GI, Oct 13, 2021.

  1. YiHan-GI

    YiHan-GI

    Joined:
    Mar 20, 2018
    Posts:
    9
    Hi,
    I am doing build automation for our unity projects, one step is to specify the unity build output path with batch mode/command line, instead of choosing the output folder when building from editor.
    I have checked this page https://docs.unity3d.com/Manual/CommandLineArguments.html, but can not find an argument for output path.
    I've also read through several files, like BuildSettings.asset, EditorUserBuildSettings.asset ProjectSettings.asset under \Library folder, and the .asset files under \ProjectSettings folder, still couldn't find any code that can assign the output path.

    I don't think Unity took all the efforts to create a usable batch mode, but does not give us the liberty to specify output path. Am I missing something here?
     
  2. fdart

    fdart

    Joined:
    Jan 4, 2019
    Posts:
    17
    +1 this question. A path can be specified when using -buildWindows64Player but not -buildTarget
     
  3. richard_unity468

    richard_unity468

    Joined:
    Oct 6, 2022
    Posts:
    1
    Did anyone find an answer for this? I also need to define an output for buildTarget.
     
  4. Streamfall

    Streamfall

    Joined:
    Aug 8, 2011
    Posts:
    43
    Hello,
    You can use the IPreprocessBuildWithReport in an editor class to get a build summary which in turn has the path. I'm attempting to modify that now, if something comes up I'll update.
     
  5. LeoArthrex

    LeoArthrex

    Joined:
    Jun 14, 2021
    Posts:
    1
    The build report doesn't return the full path for me. It returns the parent path. The outputPath in the report is read only clearly as it's a summary.

    The only way to go about doings is by running a BuildPlayer with the BuildPipeline https://docs.unity3d.com/ScriptReference/BuildPipeline.BuildPlayer.html