Unity 社区

在项目中使用Visual Studio打开脚本时,Visual Studio一直加载不出来。

,8 个月前
发布于技术支持
0
在项目中使用Visual Studio打开C#脚本时,Visual Studio一直 加载不出来,显示“正在准备解决方案”
但如果先用Visual Studio打开项目,然后再打开脚本,就可以正常加载,而且会有提示“上次加载该解决方案,打开关联文档时遇到错误。为了避免该错误,这次解决方案加载将跳过文档加载。”
534 次浏览
评论 0
3个回答
已解决
0
问题解决了。是Visual Studio插件的问题。VS2022安装了CodeMaid之后就会这样。把插件卸载了就好了
8 个月前回答
评论 0
0
可以尝试以下操作:在Edit > Preferences > External Tools中切换一下脚本编辑工具,然后再切换回来;卸载VS,清除缓存后再重新安装VS
8 个月前回答
评论 0
0
本回答由团结MuseChat(Beta)生成,请酌情参考。
以下是一些可能的解决方案,可以尝试解决在项目中使用Visual Studio打开脚本时遇到的问题:
  1. 确认Unity中的外部工具设置正确
  • 在Unity中,选择 Edit > Preferences > External Tools
  • 确认 External Script Editor 设置为Visual Studio,并且勾选 Editor Attaching
  1. 确认Visual Studio的设置
  • 打开Visual Studio,选择 Tools > Options > Projects and Solutions > General
  • 确认 Automatically reload projects when project files are changed outside the environment 选项已勾选。
  1. 清理Visual Studio的缓存
  • 关闭Visual Studio。
  • 删除 %localappdata%\Microsoft\VisualStudio\<version>\ComponentModelCache 文件夹。
  • 重新启动Visual Studio。
  1. 确认Visual Studio和Unity的版本兼容性
  • 确认使用的是最新版本的Visual Studio和Unity。
  • 如果问题仍然存在,可以尝试重新安装Visual Studio,并确保安装了 Game Development with Unity 工作负载。
  1. 手动重新加载项目
  • 在Visual Studio中,右键点击解决方案资源管理器中的项目,选择 Reload Project
希望这些步骤可以帮助你解决问题。如果问题仍然存在,请提供更多详细信息,以便进一步诊断。
[1] Visual Studio doesn't reload project after scripts are added within Unity - Unity Engine - Unity Discussions https://discussions.unity.com/t/visual-studio-doesnt-reload-project-after-scripts-are-added-within-unity/722610
[2] 解决VS不能加载Unity脚本,继承MonoBehaviour类是灰色的_unity无法加载关联的脚本,请修复编译错误-CSDN博客 https://blog.csdn.net/leoysq/article/details/123627267
[3] Visual Studio 2022 fails to open solution to selected script from Unity and keeps opening new window - Unity Engine - Unity Discussions https://discussions.unity.com/t/visual-studio-2022-fails-to-open-solution-to-selected-script-from-unity-and-keeps-opening-new-window/887222
[4] Troubleshoot Visual Studio Tools for Unity | Microsoft Learn https://learn.microsoft.com/en-us/visualstudio/gamedev/unity/troubleshooting/troubleshooting-and-known-issues-visual-studio-tools-for-unity
[5] Visual Studio Tools for Unity 故障排除 | Microsoft Learn https://learn.microsoft.com/zh-cn/visualstudio/gamedev/unity/troubleshooting/troubleshooting-and-known-issues-visual-studio-tools-for-unity
8 个月前回答
评论 0
本答案由团结MuseChat(Beta)自动生成,申请使用,反馈渠道

AI

全新AI功能上线

1. 基于Unity微调:专为Unity优化,提供精准高效的支持。

2. 深度集成:内置于团结引擎,随时查阅与学习。

3. 多功能支持:全面解决技术问题与学习需求。

AI