I’m trying to make a web player build for play testing (not editing), but I’m getting errors with UNITY_EDITOR still being defined. This is a problem because while in editor mode I’m using some IO features that aren’t available through the web player (these are wrapped in #if UNITY_EDITOR, but still being included). I can’t find where I can remove/turn off the define, or if I’m misinterpreting how the editor and builds work. Any solutions/information on the topic would be helpful.
The UNITY_EDITOR define can be a bit confusing. It is always defined while you’re in the editor, regardless of platform.
If you’re getting errors about referencing namespaces that don’t exist (System.IO is a common culprit), you might instead use something closer to this:
#if !UNITY_WEBPLAYER
...system.IO calls...
#else
...web fallback, PlayerPrefs calls, whatever (optional)...
#endif