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
6
Question by sampenguin · Apr 06, 2012 at 04:25 PM · development build

Is there any way to detect if this is a development build from script?

In most of my projects, it would be extremely useful to be able to enable/disable/destroy certain objects based on whether the application is built as a development build or not. Specifically, I'm looking for a way to branch in script based on this state.

Obviously there is something internal tracking this somewhere since Unity adds a display tag if you build that way, but I haven't been able to find any way to access this yet. Anyone have any ideas?

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
10
Best Answer

Answer by sampenguin · Apr 06, 2012 at 05:13 PM

And just found it

http://unity3d.com/support/documentation/ScriptReference/Debug-isDebugBuild.html

Description

In the Build Settings dialog there is a check box called "Development Build".

If it is checked isDebugBuild will be true. In the editor isDebugBuild always returns true.

Comment
Add comment · Show 2 · 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 Kryptos · Apr 06, 2012 at 05:22 PM 0
Share

Good to know.

avatar image Mazyod · Jan 05, 2017 at 08:14 AM 0
Share

I have to say, I am extremely frustrated with this API, since it's not even thread safe! I just need it to return a bool, and yet, I can only call it from the main thread... Boo-hoo.

avatar image
3

Answer by zauberzaubar · Sep 09, 2020 at 10:38 AM

Late to the party but for googlers: There is also

 #if DEVELOPMENT_BUILD
 #endif

More detail here: https://gamedev.stackexchange.com/questions/154604/difference-between-debug-and-development-build-in-unity

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

Answer by Kryptos · Apr 06, 2012 at 05:00 PM

Actually the purpose of the development build is to test your application like a released-one but with debugging option activated. Willing to have different scripts based on the fact that it is or not a development build makes no sense.

How will you test your real build if it is different from the development build?

Anyway Unity does not provide such option. But you can define a COMPILATION CONSTANT (`#define`) and use #ifdef in your script. When you build the release, just remove the #define.

Comment
Add comment · Show 2 · 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 sampenguin · Apr 06, 2012 at 05:07 PM 0
Share

That's an assumption. While it is true when you are looking at ideal usage of the dev build feature for simply testing a deployment, it's not the purpose I'm trying to achieve all the time.

Use case: I would like to distribute a small subset standalone build to a publishing partner that does not have the Unity engine in house, let's say to test one specific feature. I would like the publisher to have certain debugging options enabled, but do not want those to be accidentally left enabled when I package a full release build later (it's a large project, multiple people involved, with lots of nooks and crannies). It would be very clean to be able to allow certain paths to be followed when its in dev build mode, without having to make actual changes in assets or scripts that could get accidentally committed.

avatar image Kryptos · Apr 06, 2012 at 05:22 PM 0
Share

I didn't see it this way. Fair enough :)

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

7 People are following this question.

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

Related Questions

Access asset server from script 0 Answers

iOS crash only if "Development Build" turned off 1 Answer

The ads on my game runs when I run it on development build but not in release build. 1 Answer

Cannot remove Development Build -1 Answers

Build Settings or Project descriptor file in Unity 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