- Home /
Cant build my Game! UnityEditor Namespace not found?
Hey, when i try to build my game, i get the following errors:
Im using the UnityEditor namespace for the OpenFolderPanel function and for the OpenFilePanel function. When i start the game in the Editor, everything works fine but when try ti build I get these errors. Can someone tell me what I did wrong???
( IF the picture is too small, click this link for a bigger version )
Answer by tanoshimi · Jun 14, 2015 at 03:52 PM
Classes in the UnityEditor namespace can only be used in the editor, not in a build.
Answer by O4s · Jun 14, 2015 at 06:42 PM
If you were just using OpenFolderPanel etc in the Editor you can do:
#if UNITY_EDITOR
using UnityEditor;
#endif
I had that error with an Audio asset when I tried to build, so I found the above answer which worked. However I'm guessing you might be trying to use those Unity Editor features at runtime so this may not work for you.
This worked perfectly for me. I was having the same issue. So simple that I didn't even think of it.