Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by jaised · Apr 16, 2013 at 06:20 PM · buildpipelinebuildsbatch

Batch File and Script to Make Multiple Builds

I have been trying to create a batch file that I can run to call a script to make multiple builds. However, the batch starts and exits without printing any useful information, so I was wondering if you could help me identify something I may have overlooked. Thank you in advance.

Batch: %UNITY% -batchmode -nographics -quit -projectPath %~dp0 -executedMethod BuildUnityPlayer.PerformBuild

Script:

 using UnityEngine;
 using System.Collections;
 using System;
 using UnityEditor;
 
 public class BuildUnityPlayer  : MonoBehaviour {
 
     public static void PerformBuild()
     {
         // the scenes we want to include in the build
         string[] scenes = { "Scenes/A.unity", 
                 "Scenes/B.unity",
                 "Scenes/C.unity"
             };
         
         DateTime currentDate = DateTime.Now;
         string buildName = "Game-"+currentDate.ToShortDateString();
         
         // build for windows stand alone
         string windowsStandAloneBuildName = buildName+"-StandAlone.exe";
         EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.StandaloneWindows);
         BuildPipeline.BuildPlayer(scenes, windowsStandAloneBuildName, BuildTarget.StandaloneWindows, BuildOptions.None);
         
         // build for web player
         string webplayerBuildName = buildName+"-WebPlayer.exe";
         EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTarget.WebPlayer);
         BuildPipeline.BuildPlayer(scenes, webplayerBuildName, BuildTarget.WebPlayer, BuildOptions.None);
     }
 }
Comment
Add comment · Show 7
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 jaised · Apr 17, 2013 at 02:15 PM 0
Share

Any ideas? Bump.

avatar image PAEvenson · Apr 17, 2013 at 02:24 PM 0
Share

You dont have Unity open when you try to run? Correct?

avatar image jaised · Apr 17, 2013 at 02:30 PM 0
Share

No Unity is closed when I run the batch. I run this line just before the build command:

:: Can't run more than one copy of Unity at a time.

taskkill /I$$anonymous$$ Unity.exe /f

I saw some other examples do it the way I am. I ensured my scenes names were correct as well.

I have also tried moving the script to the same directory and within the project's scripts directory. Both have failed.

avatar image PAEvenson · Apr 17, 2013 at 02:34 PM 0
Share

add this to the param list so you can get the exact error "-logFile unitylog.txt"

avatar image jaised · Apr 17, 2013 at 03:01 PM 0
Share

Thank you. That confirmed that the builds are completing. I get batch was successful in the log, but I still don't see any builds in the directory at all.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by jaised · Apr 17, 2013 at 07:40 PM

Right-clicking the batch and "Run as Administrator" fixed my issue. Thank you.

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 zloty · Apr 18, 2013 at 07:45 PM 0
Share

You can use the u$$anonymous$$ate package from the asset store http://u3d.as/4rA. It is an automation tool for unity. It contains several actions like 'build player' and 'set scenes' which can be combine to a automation plan.

The project page contains a tutorial video that shows how to build multiple player for one project with u$$anonymous$$ate. http://docs.ancientlightstudios.com/display/UT/Getting+started+with+u$$anonymous$$ate

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

13 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

Related Questions

How to create a BuildOptions mask in the Editor Window? 2 Answers

SwitchActiveBuildTarget vs. buildTarget 0 Answers

Unity Build Memory Usage Patterns 0 Answers

Getting the current BuildOptions 1 Answer

Unity -executeMethod Problem (executeMethod method 'Build' in class 'TestScript' could not be found.) 2 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