Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
1
Question by RasmusDyhr · Aug 27, 2018 at 09:10 AM · buildnot workingautomationcommand lineno error

Compiling from command line

Hello! I am trying to set up some automated builds for my project using the command line, but Unity doesn't seem to want to do anything in batch mode for me.

I have tried many combinations of commands but according to the log the editor just open refreshes the assets if needed and shut down, completely ignoring the -executeMethod parameter. And this is on an empty project with just the build script and an empty scene.

Also worth noting that it exits and runs in the background rather than waiting for it to finish.

I'm running the following command:

 Unity.exe -quit -batchmode -projectPath "%cd%" -executeMethod "Builder.BuildAll"  -logfile "editor.log"

This is my build script: using System.Collections; using System.Collections.Generic; using UnityEditor; using UnityEngine;

 public class Builder : MonoBehaviour {
 
     public static void BuildAll()
     {
         BuildPipeline.BuildPlayer(
             new[] {"Test.unity"}, 
             "Build/Win/", 
             BuildTarget.StandaloneWindows64,
             BuildOptions.None);
     }
 }

And here is the log file

 LICENSE SYSTEM [2018827 10:58:55] Next license update check is after 2018-08-25T08:08:27
 
 Built from '2017.3/release' branch; Version is '2017.3.1f1 (fc1d3344e6ea) revision 16522547'; Using compiler version '160040219'
 OS: 'Windows 10  (10.0.0) 64bit' Language: 'en' Physical Memory: 16269 MB
 BatchMode: 1, IsHumanControllingUs: 0, StartBugReporterOnCrash: 0, Is64bit: 1, IsPro: 1
 [Package Manager] Server::Start -- Port 58090 was selected
 
  COMMAND LINE ARGUMENTS:
 Unity.exe
 -quit
 -batchmode
 -projectPath
 D:\Projects\CI Test
 -executeMethod
 Builder.BuildAll
 -accept-apiupdate
 -logfile
 editor.log
 Successfully changed project path to: D:\Projects\CI Test
 D:/Projects/CI Test
 Loading GUID <-> Path mappings...0.000436 seconds
 Loading Asset Database...0.005115 seconds
 Audio: FMOD Profiler initialized on port 54900
 AssetDatabase consistency checks...0.020913 seconds
 Refreshing native plugins compatible for Editor in 5.85 ms, found 0 plugins.
 Preloading 0 native plugins for Editor in 0.00 ms.
 DisplayProgressbar: Unity Package Manager
 [Package Manager] Resolving 4 packages:
 [Package Manager]  * Package :  com.unity.ads@2.0.3
     (location: C:\Users\rasmus\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.ads@2.0.3)
 [Package Manager]  * Package :  com.unity.analytics@2.0.13
     (location: C:\Users\rasmus\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.analytics@2.0.13)
 [Package Manager]  * Package :  com.unity.purchasing@0.0.19
     (location: C:\Users\rasmus\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.purchasing@0.0.19)
 [Package Manager]  * Package :  com.unity.standardevents@1.0.10
     (location: C:\Users\rasmus\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.standardevents@1.0.10)
 [Package Manager] Resolve completed
 Initialize engine version: 2017.3.1f1 (fc1d3344e6ea)
 GfxDevice: creating device client; threaded=0
 Direct3D:
     Version:  Direct3D 11.0 [level 11.1]
     Renderer: NVIDIA GeForce GTX 1060 (ID=0x1c20)
     Vendor:   NVIDIA
     VRAM:     2981 MB
     Driver:   22.21.13.8554
 Initialize mono
 Mono path[0] = 'D:/Unity/2017.3.1f1/Editor/Data/Managed'
 Mono path[1] = 'D:/Unity/2017.3.1f1/Editor/Data/Mono/lib/mono/2.0'
 Mono config path = 'D:/Unity/2017.3.1f1/Editor/Data/Mono/etc'
 Using monoOptions --debugger-agent=transport=dt_socket,embedding=1,defer=y,address=0.0.0.0:56916
 Begin MonoManager ReloadAssembly
 Refreshing native plugins compatible for Editor in 0.40 ms, found 4 plugins.
 Initializing Unity.PackageManager (PackageManager) v2017.3.1 for Unity v2017.3.1f1
 Registering precompiled unity dll's ...
 Register platform support module: D:\Unity\2017.3.1f1\Editor\Data\PlaybackEngines\AndroidPlayer/UnityEditor.Android.Extensions.dll
 Register platform support module: D:\Unity\2017.3.1f1\Editor\Data\PlaybackEngines\windowsstandalonesupport/UnityEditor.WindowsStandalone.Extensions.dll
 Registered in 0.001451 seconds.
 Refreshing native plugins compatible for Editor in 0.52 ms, found 4 plugins.
 Preloading 2 native plugins for Editor in 1.50 ms.
 Mono: successfully reloaded assembly
 - Completed reload, in  0.783 seconds
 Registering platform support modules:
 Registered platform support modules in: 0.0926783s.
 Native extension for WindowsStandalone target not found
 Native extension for Android target not found
 Begin MonoManager ReloadAssembly
 Registering precompiled user dll's ...
 Registered in 0.013650 seconds.
 Refreshing native plugins compatible for Editor in 0.42 ms, found 4 plugins.
 Preloading 2 native plugins for Editor in 0.11 ms.
 Mono: successfully reloaded assembly
 - Completed reload, in  0.904 seconds
 Initializing Unity.PackageManager (PackageManager) v2017.3.1 for Unity v2017.3.1f1
 Registering platform support modules:
 Registered platform support modules in: 0.0711601s.
 Native extension for WindowsStandalone target not found
 Native extension for Android target not found
 Validating Project structure ... 0.000232 seconds.
 Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.002218 seconds (Nothing changed)
 Warming cache for 134 main assets: 0.000240 seconds elapsed
 Initializing Unity extensions:
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnityHoloLens/Editor/UnityEditor.HoloLens.dll'  GUID: 12fd8a0055b84bb59e84c9835a37e333
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/Timeline/Runtime/UnityEngine.Timeline.dll'  GUID: 6a10b2909283487f913b00d94cd3faf5
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/TestRunner/portable/nunit.framework.dll'  GUID: 405b9b51bb344a128608d968297df79c
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll'  GUID: f70555f144d8491a825f0804e09c671c
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/GUISystem/UnityEngine.UI.dll'  GUID: f5f67c52d1564df4a8936ccd202a3bd8
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/Timeline/RuntimeEditor/UnityEngine.Timeline.dll'  GUID: 844f815391db42d49455cbf1a7bfc434
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/Networking/Standalone/UnityEngine.Networking.dll'  GUID: dc443db3e92b4983b9738c1131f555cb
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnitySpatialTracking/Runtime/UnityEngine.SpatialTracking.dll'  GUID: ed7343f30e3843b3afda8f8b02669cea
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnityGoogleAudioSpatializer/Editor/UnityEditor.GoogleAudioSpatializer.dll'  GUID: 4a3ecb1425d14502837abea459cf2b70
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/Networking/Editor/UnityEditor.Networking.dll'  GUID: 5f32cd94baa94578a686d4b9d6b660f7
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnityHoloLens/Runtime/UnityEngine.HoloLens.dll'  GUID: f7b54ff4a43d4fcf81b4538b678e0bcc
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnitySpatialTracking/Editor/UnityEditor.SpatialTracking.dll'  GUID: b5da970776034f77a070d99423d68791
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/TreeEditor/Editor/UnityEditor.TreeEditor.dll'  GUID: adebbd281f1a4ef3a30be7f21937e02f
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/Networking/UnityEngine.Networking.dll'  GUID: 870353891bb340e2b2a9c8707e7419ba
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/TestRunner/UnityEngine.TestRunner.dll'  GUID: 53ebcfaa2e1e4e2dbc85882cd5a73fa1
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnityGoogleAudioSpatializer/RuntimeEditor/UnityEngine.GoogleAudioSpatializer.dll'  GUID: ead147da21254ff9a0a936bdd75e1680
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnityGoogleAudioSpatializer/Runtime/UnityEngine.GoogleAudioSpatializer.dll'  GUID: e4f4cf1b9b434137a499903a7a1d651a
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnityVR/Editor/UnityEditor.VR.dll'  GUID: 4ba2329b63d54f0187bcaa12486b1b0f
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnityHoloLens/RuntimeEditor/UnityEngine.HoloLens.dll'  GUID: 1c6d1fbb51834b64847b1b73a75bfc77
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UnitySpatialTracking/RuntimeEditor/UnityEngine.SpatialTracking.dll'  GUID: 3a84de5cd0624681b6b6dcd8921d912a
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll'  GUID: 80a3616ca19596e4da0f10f14d241e9f
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UIAutomation/UnityEngine.UIAutomation.dll'  GUID: c768acbc9cf24d398488bb4c93b91288
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/TestRunner/Editor/UnityEditor.TestRunner.dll'  GUID: 4113173d5e95493ab8765d7b08371de4
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/TestRunner/net35/unity-custom/nunit.framework.dll'  GUID: 4b3fa4bde7f1451a8218c03ee6a8ded8
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/UIAutomation/Editor/UnityEditor.UIAutomation.dll'  GUID: b8a0574e92bd43a59e19d6c3c6ae54c7
  'D:/Unity/2017.3.1f1/Editor/Data/UnityExtensions/Unity/Timeline/Editor/UnityEditor.Timeline.dll'  GUID: 7668179ede524d6396c8b7d84461ea29
 Unloading 103 Unused Serialized files (Serialized files now loaded: 0)
 System memory in use before: 28.4 MB.
 System memory in use after: 28.3 MB.
 
 Unloading 76 unused Assets to reduce memory usage. Loaded Objects now: 665.
 Total: 1.868940 ms (FindLiveObjects: 0.858436 ms CreateObjectMapping: 0.019692 ms MarkObjects: 0.945227 ms  DeleteObjects: 0.039019 ms)
 
 Batchmode quit successfully invoked - shutting down!
 Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.002118 seconds (Nothing changed)
 Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.002037 seconds (Nothing changed)
 [Package Manager] Server::Kill -- Server was shutdown
 Cleanup mono
 Exiting batchmode successfully now!
 
Comment
Add comment · Show 12
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image NoDumbQuestion · Aug 28, 2018 at 04:20 AM 0
Share

Last Time I call method on Jenkins. The class must have namespace.

 namespace .CloudBuild$$anonymous$$ethod {
 public class Builder : $$anonymous$$onoBehaviour {
  
      public static void BuildAll()
      {
          BuildPipeline.BuildPlayer(
              new[] {"Test.unity"}, 
              "Build/Win/", 
              BuildTarget.StandaloneWindows64,
              BuildOptions.None);
      }
  }
 }

The command will be

 Unity.exe -quit -batchmode -projectPath "%cd%" -execute$$anonymous$$ethod "CloudBuild$$anonymous$$ethod.Builder.BuildAll"  -logfile "editor.log"
avatar image RasmusDyhr NoDumbQuestion · Aug 28, 2018 at 07:44 AM 0
Share

Didn't seem to change anything

Here's a log

avatar image NoDumbQuestion RasmusDyhr · Aug 28, 2018 at 07:47 AM 0
Share

Have you try to use static class?

i remember I solve it somehow with making everything static

Show more comments
avatar image RasmusDyhr NoDumbQuestion · Aug 28, 2018 at 07:53 AM 0
Share

Do you have a working project that you can share, so I tell if it's my setup or my project that's wrong?

avatar image NoDumbQuestion RasmusDyhr · Aug 28, 2018 at 07:59 AM 0
Share

Sorry no, I made a success build pipeline last year so my memory quite hazy about it.

Follow this tutorial, they use jenkins which is just wrapper around unity build command line. It give you a script for build from command line. It have no quote string inside command build. That explain why you build false

 -quit -batchmode -execute$$anonymous$$ethod PerformBuild -nographics 
 
 // C# example
 using UnityEditor;
 class $$anonymous$$yEditorScript
 {
      static void PerformBuild ()
      {
          string[] scenes = { "Assets/$$anonymous$$yScene.unity" };
          BuildPipeline.BuildPlayer(scenes, ...);
      }
 }

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by RasmusDyhr · Aug 28, 2018 at 08:34 AM

I figured it out, and there were two issues with my build script.

  • For windows, the path for the build needs to end in ".exe"

  • Scenes need to be relative to the projects ie. "Assets/Test.unity"

Unity silently ignores these errors and quits. I found them by getting the build report of the the BuildPipeline.BuildPlayer method. My working test script therefore looks like this:

 class MyEditorScript 
 {
     static void PerformBuild()
     {
         Debug.Log("### BUILDING ###");
         var report = BuildPipeline.BuildPlayer(
             new[] {"Assets/Test.unity"}, 
             "Build/Win/Test.exe", 
             BuildTarget.StandaloneWindows64,
             BuildOptions.None);
         
         Debug.Log("###   DONE   ###");
 
         Debug.Log(report);
     }
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
â–¼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

160 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

game no work when built 0 Answers

Video Player and Web GL build not working 2 Answers

I can't open my project 1 Answer

Xcode project build automation setting up app group 1 Answer

Fluid not appearing in build 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges