[英]Visual Studio Intellisense for UnityEngine not working
我正在尝试在 C# 中为 Unity 编写脚本。 我创建了脚本,然后打开了它。 当我输入Ge
时,我没有得到 Unity 方法(我只看到GetHashCode
和GetType
)。 我正在寻找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);
}
}
您需要将 VS Code 指定为默认编辑器。 编辑 > 首选项 > 外部工具 > 外部脚本编辑器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.