Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Unity C# preprocessor

Discussion in 'Scripting' started by cracksmith, Sep 9, 2009.

  1. cracksmith

    cracksmith

    Joined:
    Sep 9, 2009
    Posts:
    1
    I'm working in C#. Are there any unity specific preprocessor definitions?

    I'm looking to be able to do things like:

    #if defined(UNITY_EDITOR)
    #if defined(UNITY_WEB_PLAYER)
    #if defined(UNITY_STANDALONE)

    Is there anything like this?

    Thanks
     
    ocimum likes this.
  2. perlohmann

    perlohmann

    Joined:
    Feb 12, 2009
    Posts:
    221
    no but you can use Application.platform instead.
     
  3. cj-currie

    cj-currie

    Joined:
    Nov 27, 2008
    Posts:
    337
    But what if you need PREprocessor directives, like for when you need to include a Windows-specific assembly?
     
  4. andeeeee

    andeeeee

    Joined:
    Jul 19, 2005
    Posts:
    8,768
    Platform specific compilation has been included in Unity 3.0, but it isn't possible in earlier versions.
     
  5. MSylvia

    MSylvia

    Joined:
    May 19, 2009
    Posts:
    42