当我想编辑c# Unity脚本时,它们会在Visual Studio中打开。它应该为所有与Unity相关的代码提供自动补全,但它不起作用。
在这里你可以看到缺失的功能:
可以看到,转换对象没有打开自动完成菜单。
Unity版本:5.5.2f1 Visual studio 2015 安装Visual Studio Tools for Unity
当我想编辑c# Unity脚本时,它们会在Visual Studio中打开。它应该为所有与Unity相关的代码提供自动补全,但它不起作用。
在这里你可以看到缺失的功能:
可以看到,转换对象没有打开自动完成菜单。
Unity版本:5.5.2f1 Visual studio 2015 安装Visual Studio Tools for Unity
当前回答
请记住,如果你正在使用ReSharper工具,它将覆盖智能感知并显示它自己的。要改变这一点,在VS上,点击扩展-> ReSharper -> Options -> IntelliSense -> General,然后选择Visual Studio而不是ReSharper。
其他回答
上面的一种方法对我有用,我刚刚找到了这个问题的解决方案, 1. 首先,转到项目目录并删除.sln文件 2. 第二,进入unity,双击你的脚本。那么Visual Studio将会打开一个错误,
然后单击确定并关闭Visual Studio编辑器。 最后,关闭你的Windows防御器,然后转到你的项目目录,会有一个。csproj文件。只需双击并从Visual Studio编辑器中打开它,打开assets文件夹中的scripts文件夹,然后打开脚本,自动完成将会非常好地工作。
Go to Options on the Tools menu and then select Documents in the Environment node. (If Documents does not appear in the list, select Show all settings in the Options dialog box.) Put a tick on "Miscellaneous files in Solution Explorer" and Click OK. (This option displays the "Miscellaneous Files" node in Solution Explorer. Miscellaneous files are files that are not associated with a project or solution but can appear in Solution Explorer for your convenience if you tick this option.) Locate your file in the Solution Explorer under "Miscellaneous Files". Then drag and drop your file to where it should belong and voila! This will copy the file to where you drop it. You may now safely delete the older file under Miscellaneous Files folder if you wish to do so
学分:https://stackoverflow.com/a/47662523/10471480
如果脚本文件夹不可见:
在解决方案资源管理器中单击“显示所有文件” 找到Scripts文件夹。 右键单击脚本,选择“包含在项目中”
如果你已经做了以上所有的工作,仍然没有工作,就试试这个: 注意:你应该已经更新了VS。
Goto Unity >编辑>首选项>外部工具>外部脚本编辑器。 对我来说,我没有选择“visual studio”作为外部脚本编辑器,所以它不起作用。只要我选择了这个,双击c#文件从unity开始工作。
我希望它也能帮助到你。
我找到了另一种更方便的方法来解决这个问题:
在“解决方案资源管理器”中选择损坏的文件。 打开它的属性。 将“Build Action”字段从“Compile”切换为“None”。 然后切换回“Compile”。
这将以某种方式杀死Unity和Visual Studio之间的同步。
下一次Visual Studio重新加载项目时,将提示一个警告。 只需点击“丢弃”。
如果您使用Resharper与Microsoft Visual Studio,您需要转到 “扩展-> ReSharper ->扩展管理器”和安装扩展“统一支持”。 就像魔法一样!