The type or namespace name `EditorWindow' could not be found.

Hi,
I have a problem while building an android apk file. I tried to reinstal android sdk and jdk, but nothing helped.
I checked, that if i delete class “public class ContentDownloadWindow : EditorWindow” I can build the game, but i need this to download data from server. Any solution, please? Should i somehow use this script only in editor?

Everytime i build the game, i got errors:
“The type or namespace name `EditorWindow’ could not be found.”
“UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (BuildPlayerOptions options) [0x0021f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:187
at UnityEditor.BuildPlayerWindow.CallBuildMethods (Boolean askForBuildLocation, BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:94
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)”

1 Like

Yes, every class / function defined in the UnityEditor namespace can’t be used inside a built application.

Your ContentDownloadWindow.cs script must be inside a folder called Editor which is not included in the final app or defined between preprocessor directives:

#if UNITY_EDITOR
    public class ContentDownloadWindow : EditorWindow
    {

    }
#endif