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
3
Question by lathomas64 · Dec 23, 2009 at 02:38 PM · buildeditor-scriptingcompilingpro-only

Build from script

Forgive me if this has already been asked but i tried to search for anything on building or automatic building and found nothing on the subject.

What commands/classes do I need to use in order to get a script to build the current(or any really) project? The reason for this would be to use the command line options to be able to build a project without loading unity for example if I used blender to make changes to some of the models.

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

3 Replies

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

Answer by jashan · Dec 23, 2009 at 06:50 PM

BuildPipeline is your friend - that class provides a couple of methods to create builds from the editor ;-)

To use this from the command line, see Command line arguments. In particular, you'll be interested in: batchmode (no popup window), quit (quit Unity after work is done), projectPath (open a specific project), and executeMethod (this will be your method using BuildPipeline to create your build).

Comment
Add comment · Show 3 · 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 lathomas64 · Dec 24, 2009 at 03:05 AM 0
Share

Thank you, this is exactly the type of thing I was looking for. Sadly I won't be able to use it until I get pro. Still worth knowing though!

avatar image jashan · Dec 24, 2009 at 10:13 AM 0
Share

Ah, sorry about that - I wasn't aware this was a pro-only feature. I guess I'll add that as tag (I think that's quite a relevant "tag").

avatar image eskivor · Feb 17, 2018 at 09:46 PM 1
Share

Dead links

avatar image
3

Answer by VidRunr · Jan 27, 2013 at 04:59 PM

You can do simple builds from the command-line without Pro.

Here's little batch script I wrote for Windows. USERPROFILE is like *NIX HOME environment variable. To see the value on your system:

 echo %USERPROFILE%

I realize it is not very generic at this point. It currently resides in a single Unity project.

I did notice some stability issues with Unity 3D 3.5+ when attempting to run the build script while Unity GUI was open. When ready to build, I exit Unity GUI then run the build script.

 @echo off
 
 set PROJECT=-projectPath 
 set PROJECT_PATH="%USERPROFILE%\Documents\project\Unity\UGDE"
 
 set WIN_PATH="%USERPROFILE%\Documents\project\Unity\UGDE\build\win32\island.exe"
 set OSX_PATH="%USERPROFILE%\Documents\project\Unity\UGDE\build\osx\island.app"
 
 @REM With Unity 4 we now have Linux
 set LINUX_PATH="%USERPROFILE%\Documents\project\Unity\UGDE\build\linux\island.app"
 
 set LINUX64_PATH="%USERPROFILE%\Documents\project\Unity\UGDE\build\linux64\island.app"
 
 @REM Common options
 set BATCH=-batchmode
 set QUIT=-quit
 
 @REM Builds:
 set WIN=-buildWindowsPlayer %WIN_PATH%
 set OSX=-buildOSXPlayer %OSX_PATH%
 set LINUX=-buildLinux32Player %LINUX_PATH%
 set LINUX64=-buildLinux64Player %LINUX64_PATH%
 
 @REM Win32 build
 echo Running Win Build for: %PROJECT_PATH%
 echo "%PROGRAMFILES%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH%     %WIN%
 "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %WIN%
 
 @REM OSX build
 echo Running OSX Build for: %PROJECT_PATH%
 echo "%PROGRAMFILES%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %OSX%
 "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %OSX%
 
 @REM Linux build
 echo Running Linux Build for: %PROJECT_PATH%
 echo "%PROGRAMFILES%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %LINUX%
 "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %LINUX%
 
 @REM Linux 64-bit build
 echo Running Linux Build for: %PROJECT_PATH%
 echo "%PROGRAMFILES%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %LINUX64%
 "%ProgramFiles(x86)%\Unity\Editor\Unity.exe" %BATCH% %QUIT% %PROJECT% %PROJECT_PATH% %LINUX64%
 
 
 PAUSE
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
Wiki

Answer by Hoten · Dec 22, 2014 at 07:45 AM

I adapted VidRunr's bash script for my own build process. Here is a excerpt from it that shows how to build a Unity project with Ruby. This solution is much more succinct - you can actually tell Unity.exe to build to more than one platform at a time.

 print "Build name?\n> "
 build_name = $stdin.gets.chomp
 
 base_dir = Dir.pwd
 $build_dir = build_dir = "#{base_dir}/builds/#{build_name}"
 server_dir = "#{build_dir}/gridia-#{build_name}-server-standalone"
 win32 = "-buildWindowsPlayer #{build_dir}/gridia-#{build_name}-win32/client.exe"
 win64 = "-buildWindows64Player #{build_dir}/gridia-#{build_name}-win64/client.exe"
 osx = "-buildOSXPlayer #{build_dir}/gridia-#{build_name}-osx/client.app"
 linux32 = "-buildLinux32Player #{build_dir}/gridia-#{build_name}-linux32/client.app"
 linux64 = "-buildLinux64Player #{build_dir}/gridia-#{build_name}-linux64/client.app"
 
 puts 'building clients for each platform'
 unity = '"%PROGRAMFILES%/Unity/Editor/Unity.exe"'
 `#{unity} -batchmode -quit -projectPath #{base_dir}/Client #{win32} #{win64} #{osx} #{linux32} #{linux64}`


Of course, you'd have to tinker the destination/project paths to suit your project.

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

Dynamically loading scripts 4 Answers

Programmatically Exporting an Asset Package 4 Answers

Help with door animation 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