【问题标题】:Visual Studio Intellisense for UnityEngine not working用于 UnityEngine 的 Visual Studio Intellisense 无法正常工作
【发布时间】:2020-04-04 00:33:46
【问题描述】:

我正在尝试用 C# 为 Unity 编写脚本。我创建了脚本,然后打开了它。当我输入 Ge 时,我没有得到 Unity 方法(我只看到 GetHashCodeGetType)。我正在寻找GetComponent。我尝试编写脚本(来自教程),它在 Unity 中运行良好,所以只有智能感知不起作用。它也不适用于new Vector3()

我正在使用 Visual Studio Community 2019 (v 16.5.2)。

完整的脚本是:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AddConstantVelocity : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        GetComponent<Rigidbody>().velocity = new Vector3(2, 10, -6);   
    }
}

【问题讨论】:

    标签: c# visual-studio unity3d


    【解决方案1】:

    您需要将 VS Code 指定为默认编辑器。 编辑 > 首选项 > 外部工具 > 外部脚本编辑器

    【讨论】:

    • 我关闭了文件,将编辑器更改为 VS Code,它下载了一些东西,它工作了。然后我将编辑器更改为 Visual Studio 2019,现在它也可以在 Visual Studio 2019 中使用,非常酷。
    猜你喜欢
    • 1970-01-01
    • 2017-10-15
    • 2011-05-28
    • 2021-08-22
    • 2015-08-23
    • 1970-01-01
    • 2017-05-13
    • 2022-11-05
    • 2013-01-09
    相关资源
    最近更新 更多