我的脚本有点问题.当我用Visual Studio为Unity编写C#脚本时,似乎我在记事本中工作,没有自动完成(正确吗?)而且我必须写得非常慢.
请观看视频.在开始是正常情况(从教程),第二部分显示我的问题.
例如,该transform课程不显示建议或自动完成.
有问题的图片:
Unity版本:5.5.2f1
Visual Studio 2015
安装了Visual Studio Tools for Unity
问题:智能感知不工作为统一的具体方法和功能(即Update,FixedUpdate,Awake等等)。
它的工作,但是,对于非统一的具体方法(即IEnumerator,void,public,float,int,等)和统一的具体变量(即Gameobject,transform,camera,等),并统一命名空间特定(即UnityEngine,UnityEditor,Unity,等)。
我正在使用:Visual Studio Code 1.41、Unity 3d 2018.4.15f1(我在使用 2019.2.x 时遇到了同样的问题)。
我尝试了以下解决方案但没有结果:
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>到 <TargetFrameworkVersion>(Currently installed version)</TargetFrameworkVersion>但统一自动默认返回至v4.7.1可能的问题:
项目创建的 sln 文件读取
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Assembly-CSharp", "Assembly-CSharp.csproj", "{B2B58FB2-4462-6B0C-A872-40DD957E5FE0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) …Run Code Online (Sandbox Code Playgroud)我正在关注有关Unity的教程,并且看到讲师在编写方法名称时具有智识。
但是我对类和变量只有智能感知,我的意思是像Rigidbody这样的Unity类和我自己的变量。
我也读过: 自动补全在Visual Studio中不起作用
VS Code 中的 Omnisharp 会产生很多关于 Unity 项目的警告。为什么?
当我从 Unity 编辑器在 VS Code 中打开脚本时,我看到的是:
Omnisharp 发出警告。这里有几个:
[warn]: OmniSharp.MSBuild.ProjectLoader
The referenced project 'Unity.Timeline.Editor.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
The referenced project 'Unity.VSCode.Editor.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
The referenced project 'Unity.TextMeshPro.Editor.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
The referenced project 'UnityEngine.UI.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
The referenced project 'Unity.Timeline.csproj' does not exist.
[warn]: OmniSharp.MSBuild.ProjectLoader
...
[warn]: OmniSharp.MSBuild.ProjectManager
Expected project reference c:\Projects\Unity\Combo Bombo\Unity.2D.Sprite.Editor.csproj to be already loaded for project Assembly-CSharp
[warn]: OmniSharp.MSBuild.ProjectManager
Expected …Run Code Online (Sandbox Code Playgroud)