how can I Execute a line of C# code only on Standalone Build
I tried
#if UNITY_STANDALONE
Debug.Log("On Build");
#endif
But still on console “On Build” gets printed.
how can I Execute a line of C# code only on Standalone Build
I tried
#if UNITY_STANDALONE
Debug.Log("On Build");
#endif
But still on console “On Build” gets printed.
You can use preprocessor defines like normal boolean operations. So to have “On Build” get printed only in your standalone build and not in the editor simply check for UNITY_EDITOR like this:
#if UNITY_STANDALONE && !UNITY_EDITOR
Debug.Log("Do Build");
#endif