简体   繁体   English

在Visual Studio中打开统一代码段

[英]Turn on unity code snippets in Visual Studio

I've installed Unity, VS-2019, Net4.x. 我已经安装了Unity,VS-2019,Net4.x。

After all, Intellisense know what when I write "Rig..." I mean RigidBody, but It doesn't autocomplete methods like OnTriggerExit() or even Start() and Update(). 毕竟,Intellisense知道我写“ Rig ...”时的意思是RigidBody,但它不会自动完成OnTriggerExit()甚至Start()和Update()之类的方法。 How can I enable it? 如何启用它?

I've specified VS executable in unity preferences, net4.x and reloaded both unity and VS many times. 我已经在统一首选项net4.x中指定了VS可执行文件,并多次重载了unity和VS。

public class SomeScript : MonoBehaviour 
{
    private Rigidbody rb;
    void Start ()
    {
        this.rb = GetComponent<Rigidbody>();
        //this line autocompleted well
    }

    void OnTrigger... // doesn't autocomplete
}

Sometimes this results from the Incompatibility between Unity and VS version. 有时,这是由于Unity和VS版本之间的不兼容性造成的。 So make sure you use Unity2019 with VS2019, and update them to latest version. 因此,请确保将Unity2019与VS2019一起使用,并将其更新为最新版本。

Check the external tools setting in Unity, make sure the external script editor in it is set as corresponding VS version. 检查Unity中的external tools setting ,确保其中的external script editor设置为对应的VS版本。 (For your situation, choose the VS2019) (根据您的情况,选择VS2019)

Then you can check if this issue persists after unloading and reloading the project in Solution explorer. 然后,您可以在“解决方案资源管理器”中卸载并重新加载项目后,检查此问题是否仍然存在。

Also, I suggest you can follow the detailed steps from this similar issue to trouble-shooting and resolve this issue. 另外,我建议您按照从类似问题到解决问题的详细步骤进行操作,并解决此问题。 Hope it helps:) 希望能帮助到你:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM