Differentiate between preview / browser in script

i’m pretty sure it’s somewhere in the docs, but i haven’t found it yet…:

how can i differentiate whether the code is running/compiled for the editorpreview (the “ᗧ Game”-Tab) so i can fake up my jslib stuff like

#if UNITY_WEBGL
   [DllImport("__Internal")]
   private static extern void CopyFileData(string filename, IntPtr dst);
#else
   private void CopyFileData(string filename, IntPtr dst) {
      //some dummy implementation
   }
#endif

or something like

void Start() {
   if (UnityEngine.Player.IsPlayMode) {
      LoadFileFromDisk(@"c:\dev\myproject\init.config");
   }
}

Use

#if UNITY_WEBGL && !UNITY_EDITOR

which one defines exactly what?

Is this the page you were looking for ?

thanks marco :slight_smile: i guess so