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 Chimera91 · Oct 12, 2016 at 04:07 PM · c#batch

Running a Unity build (.exe) from a batch file

I am creating a build pipeline with TeamCity and have ran into an issue with running the created build from a batch file.

This process used to work fully around 5.3.4p5 but since then when I run this line from the batch file:

 set TEST_OUTPUT_FILE=%~dp1testlog.txt
 
 :: run the exe
 %1 -logFile %TEST_OUTPUT_FILE%

It initially loads the app in the background but does nothing after that, e.g. Task Manager reports the app is not using any CPU or memory.

When checking the log file the bottom most entry is this error:

 IndexOutOfRangeException: Array index is out of range.
   at UnityEngine.Display.RecreateDisplayList (System.IntPtr[] nativeDisplay) [0x00030] in C:\buildslave\unity\build\artifacts\generated\common\runtime\UnityEngineDisplayBindings.gen.cs:126 
  
 (Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDisplayBindings.gen.cs Line: 126)
 
 desktop: 1024x768 60Hz; virtual: 1024x768 at 0,0
 Switching to resolution 1024x576 failed, trying lower one
 All resolution switches have failed
 Screen: DX11 could not switch resolution (1024x576 fs=0 hz=0)

I can confirm:

  • The file path (%1) is correct

  • Running Unity 5.4.1p3

  • App loads correctly if you double click the .exe

  • App loads correctly if you run it from the Command Prompt

  • App loads correctly if you add the "-batchmode" command to the exe execution line

  • This process used to work fully beforehand

  • This batch file is being triggered by TeamCity

I can only assume it is something to do with DirectX 11 not initialising properly but apart from that, I have no idea.

I appreciate any help you can give.

Update: After looking through the build logs I found this error:

 Aborting batchmode due to failure:
 Failed to build player.
 
 
 Unhandled Exception: System.IO.DirectoryNotFoundException: Directory 'C:\TeamCity\buildAgent\temp\buildTmp\745a85f3' not found.

This happens at the previous step before it runs the build, starting to think its a TeamCity thing, will keep investigating.

Comment
Add comment
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

1 Reply

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

Answer by Chimera91 · Oct 14, 2016 at 09:20 AM

Found out that using the pre-installed build agent running as a service was the issue.

To fix this install another agent through TeamCity and disable the original agent.

The new agent should not be a service and will run any .exe properly.

Comment
Add comment · Show 1 · 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 michael_house · Mar 07, 2018 at 04:23 PM 0
Share

This still solved my problem using the latest TeamCity and Unity 2017.2.1. Thanks!

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

247 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 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

How can I use SQLite Database made with android studio in Unity? 0 Answers

Check if a point is on the right or left of a vector? 2 Answers

Assigning Values In Start () That Will Change 1 Answer

Draw Line Between Distance Joint 2D and Position 0 Answers

How to make an enemy who will walk behind all players if they go into the radius? Finding by the tag Player. [PUN]. 1 Answer


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