This is the error in the console:
The type or namespace name `UnityEditor’ could not be found. Are you missing a using directive or an assembly reference?
I’m using Unity 2.6.1 pro [C#]
This is the error in the console:
The type or namespace name `UnityEditor’ could not be found. Are you missing a using directive or an assembly reference?
I’m using Unity 2.6.1 pro [C#]
Oh, I see now.
It isn’t in the “Editor” folder.
maybe you miss some libraries which you use,add them at the begin:using libraryName;
I have same problem , can you explain this ?
GIOWorks: Create a folder in your Project, name it “Editor”, and drag your script into the folder.
Yes thanks i did it. It works
A better answer is this "UnityEditor" namespace not found... - Questions & Answers - Unity Discussions
… by putting #if UNITY_EDITOR before the using UnityEditor directive and #endif after it.
#if UNITY_EDITOR
using UnityEditor;
#endif
THE BEST BEST BEST BEST BEST BEST ANSWER!!!
This thread is six years old. What works now may not have been available back then.
It’s also not a “better” answer, because in most cases when you have “using UnityEditor”, you’re writing an editor script, so there’s going to be lots of other editor-only stuff in it, and putting “#if/#endif” around “using UnityEditor” won’t help much. Generally it’s best just to put editor scripts in a folder called “Editor” (doesn’t have to be in the root) and call it a day. If you have a run-time script that happens to have some editor-only functionality in it, then sure, conditional compilation makes sense in that case.
–Eric