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 /
avatar image
2
Question by spmonahan · Dec 16, 2015 at 12:26 PM · build-errorcommand-lineautomated

Command line build failing but works great when run from the editor.

I'm working on setting up automated builds for a Unity 5 project and I've made some progress building within Unity but now that I'm moving on to building from the command line I'm running into a snag and hopeful I can get some help.

To start I've made a static class and added some menu items to Unity for single-click builds. Some sample code:

 using UnityEngine;
 using UnityEditor;
 
 namespace Builds
 {
     public static class AutomatedBuilds
     {
         private static string _buildPath = "mypath";
         private static string _appName = "myapp";
         private static string _buildNumber = "0.0.0";

         [MenuItem("Build Tools/Windows x64 Debug", false, 0)]
         public static void BuildWindows_x64_Debug()
         {
             BuildPipeline.BuildPlayer(
                 _levels,
                 string.Format("{0}/{1}/{2}_{3}_{4}.exe", _buildPath, "win", _appName, "Debug", _buildNumber),
                 BuildTarget.StandaloneWindows64,
                 BuildOptions.AllowDebugging
             );
         }
     }
 }
 

After this script gets compiled by Unity I get a menu item called "Build Tools" with a command called "Windows x64 Debug". Clicking this invokes the build and it all works great: my build gets made and I can run it no problem.

My next step is to run this all from the command line. The command I'm running looks like:

 '"C:\\Program Files\\Unity\\Editor\\Unity.exe" -projectPath E:\path\to\UnityProject -batchMode -executeMethod AutomatedBuilds.BuildWindows_x64_Debug -logFile E:\path\to\BuildLog\build.log -nographics -quit'

This also runs but I get the following output in the console:

 Aborting batchmode due to failure:
 Scripts have compiler errors.

Since that's a vague error message I've checked the build.log file generated with the command and there is a ton of stuff in there but it all looks like general build stuff except for this bit toward the end:

 -----CompilerOutput:-stderr----------
 
 Assets/Scripts/Test/TestUI.cs(17,27): error CS0234: The type or namespace name `Dropdown' does not exist in the namespace `UnityEngine.UI'. Are you missing an assembly reference?

The file in question looks like:

 using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.Assertions;

 using GameEvents;
 using DataContracts;

 public class TestUI : MonoBehaviour {

     public InputField[] SetCardFields;
     public GameObject TestPanel;

     public GameObject DeckView;
     public GameObject TestCardPrefab;

     [Header("Charm Setter")]
     public Dropdown CharmSelectionDropdown; // <-- THIS IS THE LINE CALLED OUT IN THE LOG

     // more but you get the idea

I've confirmed that Dropdown is a Unity UI class so it should be good (also it compiles when running Unity).

I'm running Unity 5.2.2f1 64 bits on Windows 10 x64. I have a similar script (though the project doesn't currently use Unity UI) that builds a different project without issues from the command line.

Ideally I need to stick with 5.2.2f1 as I'm working with a team and cannot just upgrade on a whim. If this is a known bug in 5.2.2f1 then an upgrade is probably called for but a Google search reveals nothing.

So, my question: why does Unity crash when building from the command line but not from within the Unity application itself? What are steps can I take to get to the bottom of this?

Comment
Add comment · Show 1
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 spmonahan · Dec 18, 2015 at 04:51 AM 0
Share

The Dropdown class definitely seems to be an issue. I've commented it out of my project and I can now get the project to build. I have some other issues to work through as the built app isn't functioning properly but Dropdown seems to have issues with command line builds.

3 Replies

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

Answer by spmonahan · Dec 22, 2015 at 09:05 AM

Turns out the problem was that I was pointing to the wrong version of Unity. I have Unity 5.2.2f1 installed at "C:\Program Files\Unity5\Editor\Unity.exe" while my script was pointed at "C:\Program Files\Unity\Editor\Unity.exe".

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
avatar image
1

Answer by DougRichardson · Nov 10, 2017 at 11:34 PM

I had the same problem you did, but only had a single version of Unity installed. In my case, getting rid of the -nographics option fixed my problem.

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
avatar image
0

Answer by kiranmaya · Sep 16, 2016 at 06:51 PM

i too made same mistake..

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Standalone MacOS build - PlayerIcon.icns problem 1 Answer

Weird errors when running Unity from the command line 1 Answer

How to check error when Unity build by command line 1 Answer

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers

Error on android game building, Win32Exception: ApplicationName='F:/Android SDK\tools\zipalign.exe', CommandLine='4 5 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