案例一:

背景:打包时提示”Error building Player because scripts had compiler errors“和其他代码编译不过的异常提示(”/ToLua/ToLua/Editor/ToLuaMenu.cs(26,7): error CS0246: The type or namespace name `UnityEditor' could not be found“),代码跑到”       BuildPipeline.BuildStreamedSceneAssetBundle“就中断了。

原因:在非Edtor目录下使用了UnityEditor代码(看起来在Plugin中嵌套Editor文件夹,Editor文件夹不会起作用的)。
解决方案:
将使用到UnityEditor相关的代码放到未嵌套在Plugins下的Editor目录下
(实际上Assets\Plugins\LuaPlugin\ToLua\Editor挪到Assets\Editor\ToLua)
参考:
http://answers.unity3d.com/questions/396311/error-while-build-app-game-with-assetbundle-menu-c.html
http://answers.unity3d.com/questions/316805/unityeditor-namespace-not-found.html
同异常的其他情景:
https://www.reddit.com/r/Unity3D/comments/27i9lx/using_unity_integration_package_for_oculus_rift/
http://blog.csdn.net/wldrswgzmb/article/details/50522247