Resolved UnityEditor Build Errors

There is a lot of editor specific code that was causing errors when you
build. All Editor specific code has been surrounded in #if UNITY_EDITOR
selectors to allow this to compile.