m0_60461532
2021-07-25 20:42
采纳率: 100%
浏览 72
已结题

unity打包出错怎么解决?第一次用

第一次用unity 打包的时候遇到这个报错 endgame这几个脚本也是按照网上教程做的 不太清楚具体的解决方法 求 解 答

报错内容:
Assets\Assets s\scripts\LoadingGame.cs(9,9): warning CS0618: 'Application.LoadLevel(string)' is obsolete: 'Use SceneManager.LoadScene'

Assets\Script\endGame.cs(9,9): error CS0234: The type or namespace name 'EditorApplication' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

Error building Player because scripts had compiler errors

Build completed with a result of 'Failed'
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at E:/unity/Modules/IMGUI/GUIUtility.cs:179)

UnityEditor.BuildPlayerWindow+BuildMethodException: 2 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x00242] in E:\unity\Editor\Mono\BuildPlayerWindowBuildMethods.cs:194
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in E:\unity\Editor\Mono\BuildPlayerWindowBuildMethods.cs:97
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at E:/unity/Modules/IMGUI/GUIUtility.cs:179)

Assets\Assets s\scripts\LoadingGame.cs(9,9): warning CS0618: 'Application.LoadLevel(string)' is obsolete: 'Use SceneManager.LoadScene'

报错的图:
img

两个场景项目:

  • img

img

  • 收藏

2条回答 默认 最新

  • 学长很忙 2021-07-26 12:39
    已采纳

    核心报错是编译错误,是不是应该写成
    Using UnityEngine.SceneManager.Load巴拉巴拉

    1 打赏 评论
  • 陈言必行 2021-07-27 16:09

    第一个错误是使用了过时的方法,解决方法:https://czhenya.blog.csdn.net/article/details/76855591
    第二个错误是在endGame这个代码第9行,缺少命名空间”UnityEdito“,修改完成后看看是否还有错误

    2 打赏 评论

相关推荐 更多相似问题