passing global #defines to BuildPipeline.BuildPlayer's "BuildOptions" ?

Wonder why that is not possible ?
or is there some hidden trick to achieve this ?

What i want to do is passing something like “#define TRIAL_VERSION” in the BuildOptions, in the code i would than simply display a trialversion string and adjust some other game options …

Anyone have some tips&tricks regarding this ?

Unity 3 has some standard defines but i don’t think you can make your own. Im not sure though.

I think you would need to builds for this. So having a global somewhere saying trial = 1.

Process this global on startup so

if( trial)
GameObject pObj = Instantiate( trialObject ) // Trial obj has a GUIText component
DontDestroyOnLoad( pObj )

Now that object will be around forever. You can store the value in the player prefs if need be so you can alter it later.

Yes - that’s exactly the thing i’m doing currently → but it’s not very convenient → i simply wanted to be able to build via my custom Editormenu called “Build Lite Version” or “Build Full Version”. Now i always have to remember to correct that global variable before doing so …

I stumbled across a thread a while ago where a dev said you can add your own defines but it seemed quite advanced. Search custom defines on the forum and you should find it.

The only other way i can think of is in the (compiled) project add the defines yourself and pump a message back to a unity object telling it to enable this. In Unity iPhone there is UnitySendMessage(char*,char*,char*) where you can send data back and forth.

If anyone is still looking at this, seems like Unity4 has a fix.

Also changes can be done via the PlayerSettings inspector. The format is DEFINE1;DEFINE2. Make sure you don’t repeat a define multiple times because the Unity build process will throw a duplicate key exception.