Hi.
It was my first attempt to build my game after updating to Unity 4.3, and this is what I got in the console after clicking ‘Build’:
[17981-screen+shot+2013-11-16+at+05.54.58+am+(2).png|17981]
The error is referencing to the highlighted line of the script on the right. I am unsure what to do, as the line is clearly correct, and it compiles fine, until I try to build the game.
It is an editor script, and it is only there to allow me to quickly clear all PlayerPrefs data. I do not need the script during runtime. Is there a way to exclude it from the build? If so, could that make the error disappear? Or could I deal with this error some other way?
Thanks in advance!
The UnityEditor namespace is not available in builds.
The easy solution is to put the script in a folder named Editor. Anything inside of folders named Editor is not included in builds. Since the entire script can be excluded you should do this.
Side note: When you want to exclude only part of a script you can enclose it in compiler flags.
// Runtime code here
#if UNITY_EDITOR
// Editor specific code here
#endif
// Runtime code here
Side note 2: Your ClearPlayerPrefs class should inherit from ScriptableObject since it shouldn’t be attached to objects.
,And how to apply properties to serialized object in build?
I work with inputmanager. And I need to work with it in build?