x


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?

more ▼

asked Apr 06, 2012 at 04:25 PM

sampenguin gravatar image

sampenguin
201 11 906 25

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Apr 06, 2012 at 05:13 PM

sampenguin gravatar image

sampenguin
201 11 906 25

Good to know.

Apr 06, 2012 at 05:22 PM Kryptos
(comments are locked)
10|3000 characters needed characters left

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.

more ▼

answered Apr 06, 2012 at 05:00 PM

Kryptos gravatar image

Kryptos
8.4k 2 15 51

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.

Apr 06, 2012 at 05:07 PM sampenguin

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

Apr 06, 2012 at 05:22 PM Kryptos
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x25
x9

asked: Apr 06, 2012 at 04:25 PM

Seen: 4081 times

Last Updated: Apr 06, 2012 at 05:22 PM