In one of my C# files I call the UnityEditor.EditorUtility.InstanceIDToObject() method.
When compiling and running in the editor everything runs fine, however, when I try to build to a windows stand-alone application I am presented with the error “The name `UnityEditor’ does not exist in the current context”
If I use the Unity Editor Name space instead,
Using UnityEditor;
EditorUtility.InstanceIDToObject()
Once again, works fine playing in the editor, stand alone build fails with error:
“The type or namespace name `UnityEditor’ could not be found. Are you missing a using directive or an assembly reference?”
UnityEditor.dll has been referenced in all of my visible MonoDevelop projects by default.
So like my previous comment guessed at actually using #if UNITY_EDITOR (basically telling unity to ignore the script UNLESS it is using the unity editor) breaks my game and throws more compile errors, I want to use this function during stand alone gameplay. I have tried using compiler directives to include the script and it’s dependencies like