Hello *,
when I’m programming in Delphi I often use compiler commands. Are there those compiler commands also available in Unity?
Something like:
{$Define Demo}
{$Ifdef Demo}
{$else}
{$Endif}
Thank you,
Ulrich
Hello *,
when I’m programming in Delphi I often use compiler commands. Are there those compiler commands also available in Unity?
Something like:
{$Define Demo}
{$Ifdef Demo}
{$else}
{$Endif}
Thank you,
Ulrich
Technically yes, but it’s shaky.
If you know Perl you can add your own Defines, but in C# Defines are both File Scope only and must be before any other information within the file.
That makes them pretty useless without a global define space.
Luckily compile_any.pl can create global defines but you must understand Perl to do that.
But once you get those defines added you can check out the MSDN for C# define commands, as all are functional inside Unity.
General syntax is:
#define X
#ifdef X
#endif
#elif Y
#else
#undef
This one will only create and call functions if X is defined (good for Asserts).
[Conditional “X”]
But still the kicker is getting your define into compile_any.pl
compiler directives, the C# counterpart, are like #define etc
they work but they are local to the script only, they don’t exist in other scripts.