How can i use C#'s Conditional Attribute in Unity iPhone?

I'd like to try and make some code debug only, as such i'd like to remove as much of it as possible when i'm making a release build. According to this page

C# has just such a thing to do this, in its Conditional attributes. Yet i've tried this in unity iPhone and it doesn't seem to compile. I'm not sure whether this works in standard unity or not with its more up to date mono implementation, but i've asked elsewhere what version of mono unity iphone uses to try and track down this problem.

I've tried

`#define ENABLED`



` [ConditionalAttribute("ENABLED")] // doesn't seem to compile :(`

` static public void DebugFunc(object val) {}`

I've also tried using ConditionalAttribute("ENABLED") and Conditional("ENABLED"), neither working.

Anyone got any idea why this doesn't work? It could be VERY VERY helpful!!!


Conditionals do work with mono (at least with 2.6.1) but I have never tried with iPhone. #if #endif definitely do work however... not sure if that helps...

I seem to be able to make this work by doing this

using ConditionalAttribute = System.Diagnostics.ConditionalAttribute;

not sure whether this is since the latest 1.6 version of Unity iPhone or not.

I just can't tell whether this will compile out any calls to the function at the callee point. ie. if you are calculating strings as params will these whole steps be skipped if conditional attribute is used to remove the function you are calling.