Visual Studio中的Openin Unity脚本不起作用

发布于 2025-01-20 06:16:41 字数 404 浏览 0 评论 0原文

我在获取最新版本的 Unity 与其推荐的 Visual Studio 2019 一起工作时遇到问题。我对它们进行了全新安装,是通过使用 Unity Hub 安装程序完成的。我创建一个新项目,制作一个普通的 C# 脚本,并尝试使用 Visual Studio 打开它。 Visual Studio 打开,但没有打开项目,没有显示文件,甚至没有弹出项目浏览器。

我用谷歌搜索了一下,我能找到的唯一推荐建议是确保 Unity 包管理器安装了 Visual Studio 包(它确实有),并且是最新版本。我不知道还能做什么。 输入图片此处描述

I'm having issues to get the latest installment of Unity to work along with it's recommended visual studio 2019. I have a fresh instalation of both of them, done by using the unity hub installer. I create a new project, and make a vanilla c# script and try to open it with visual studio. Visual studio opens, yet there is no project opened, no file shown, not even the project browser pops up.

I have googled a bit and the only recommended sugestion I can find is about making sure that the unity package manager has the Visual Studio package installed which it does have, to the latest version. I don't know what else to do.
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

舞袖。长 2025-01-27 06:16:41

我设法找到了答案。看来我需要做的就是进入Unity ->编辑->首选项->外部工具并选择 Visual Studio 2019 作为我的代码编辑器。然后确保已选中“生成 csproj 文件”。似乎由于某种未知的原因,Unity 默认情况下没有启用此选项,即使我在 Unity Hub 安装程序中指定我希望 Visual Studio 作为我的编辑器,并且我希望所有配置都会自动完成。

I managed to figure out my answer. It seems that what I needed to do was to go into Unity -> Edit -> Preferences -> External tools and select Visual Studio 2019 as my code editor. Then make sure that the Generate csproj file was checked. It seems for some unknown reason that unity does not have this option enabled by default, even though I specified in the Unity Hub installer that I want Visual Studio to be my editor, and I would have expected that all the configurations would have been done automatically.

最丧也最甜 2025-01-27 06:16:41
  1. UNITY和VS版本不匹配,尝试更改VS版本(Unity Editor- editor- editor- editor- preverences->外部工具 - > external script Editor);

  2. 删除项目中的“ .vs”文件夹(默认情况下隐藏了此文件夹,您需要打开隐藏的文件才能查看它。此文件夹大胆删除,VS将在删除后自动创建它)。

  3. 删除“ assembly-csharp.csproj”,“ assembly-csharp-editor.csproj”和“ .sln”文件。 (大胆地删除,删除后,VS将自动创建)

  1. Unity and VS versions do not match, try changing the VS version (Unity Editor->Edit->Preferences->External Tools->External Script Editor);

  2. Delete the ".vs" folder in the project (this folder is hidden by default, you need to open the hidden files to see it. This folder is boldly deleted, and VS will automatically create it after deletion).

  3. Delete the "Assembly-CSharp.csproj", "Assembly-CSharp-Editor.csproj" and ".sln" files. (Boldly delete, after deleting, VS will automatically create)

幸福%小乖 2025-01-27 06:16:41

对于Mac解决方案,

转到系统首选项 - >隐私&安全 - >完整磁盘访问 - >单击(+)图标并添加Visual Studio Loaction

,然后重新启动MacBook并打开问题解决问题!

For Mac Solution

Go to System Preferences -> Privacy&Security -> full Disk Access -> Click (+) icon and add visual studio loaction

and then restart Macbook and open it problem solved!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文