Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Conditional Compilation Question

Discussion in 'Scripting' started by calinpavel, May 13, 2022.

  1. calinpavel

    calinpavel

    Joined:
    Sep 10, 2021
    Posts:
    10
    Hello guys,

    what I have:
    Code (CSharp):
    1. url = "file:///" + Application.streamingAssetsPath;
    But, this code will work only on Unity Editor on Windows.

    in macOS, to make it work I need the link to be
    file://
    , so with 2(two) slashes.

    I tried with
    Code (CSharp):
    1. #if UNITY_EDITOR_OSX
    and
    Code (CSharp):
    1. #if !UNITY_EDITOR_WIN
    , but none of them seems to work.

    I'm using the Unity Editor 2020.3.29f1

    Thank you in advance.
     
  2. _met44

    _met44

    Joined:
    Jun 1, 2013
    Posts:
    633
    _EDITOR preprocessor vars are true only when compiling for the editor, when running out builds it will always be false since its not compiling for the editor but for the player so you need to use the other ones without _EDITOR in it