当我想编辑c# Unity脚本时,它们会在Visual Studio中打开。它应该为所有与Unity相关的代码提供自动补全,但它不起作用。

在这里你可以看到缺失的功能:

可以看到,转换对象没有打开自动完成菜单。

Unity版本:5.5.2f1 Visual studio 2015 安装Visual Studio Tools for Unity


当前回答

从Unity选择编辑选项,然后~>首选项…~>外部工具,然后打开内置包。我尝试了所有的解决方案,只有这一个帮助我,我打开它的机会!

其他回答

我的自动补全也不能工作,因为没有安装Visual Studio Tools for Unity。因此,在安装之后,删除自动生成的Visual Studio文件。其他人说你再次打开文件,问题就解决了,但事实并非如此。

诀窍在于:你不需要双击文件,而是需要在Unity中右键单击“open c# Project”来打开c#文件。

>“外部工具”->设置你的外部工具

这是一个解决办法。对于VS,你也可以使用JetBrains的ReSharper,但我推荐使用Rider。那一本也是学生免费的。 它提供的性能不如visual studio,但肯定比VS+Resharper要好。

祝你今天愉快,伙计)

尝试按Ctrl + Alt + Space(可以在建议补全模式和标准补全模式之间切换)

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文件夹。 右键单击脚本,选择“包含在项目中”

对于Windows或macOS:

下载/安装Visual Studio IDE(带有Unity工具)

安装时,确保包含安装

使用Unity开发游戏

然后使用Unity(你可以双击一个c#文件),打开一个新的c#项目,Visual Studio IDE应该会打开你的新项目结构。

从那里,你应该能够看到你在寻找什么。

例如:

Linux(建议):

尝试Monodevelop -附加信息,它提供代码完成/提示。