- Home /
how to remove the unity_editor define in web player
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.
UNITY_EDITOR should work, but sometimes the compiler can get confused. (it's also possible that you missed a spot somewhere that also needs to be so wrapped). Sometimes moving the script to a different folder, nested differently, and/or being in a folder named "Editor" can help un-confuse the compiler.
Answer by rutter · Feb 11, 2014 at 03:30 AM
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
Yeah, I did think of going that way and using the UNITY_WEBPLAYER define, but I wanted to know how to make a build without the editor at all. Since this was getting included, it must be adding other editor elements as well; which I don't really want.
Your answer
Follow this Question
Related Questions
Remove UNITY_EDITOR define even for in-Editor builds? 2 Answers
Build unity application using a unity application. 1 Answer
Distribute terrain in zones 3 Answers
Build and Editor collisions behaving different? 0 Answers
Execute Editor method on Build 0 Answers