0

I am trying to write a script for Unity in C#. I created the script and then I opened it. When I typed in Ge, I don't get Unity methods (I only see GetHashCode and GetType). I am looking for GetComponent. I tried writing the script (from a tutorial) and it works fine in Unity, so only the intellisense is not working. It also doesn't work for new Vector3().

I am using Visual Studio Community 2019 (v 16.5.2).

The complete script is:

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);   
    }
}

JVE999
  • 3,327
  • 10
  • 54
  • 89

1 Answers1

1

You need to specify VS Code as the default editor. Edit > Prefernces > External tools > External Script Editor

  • 1
    I closed the file, changed the editor to VS Code, it downloaded some things, and it worked. I then changed the editor to Visual Studio 2019 and now it works in Visual Studio 2019, too, which is pretty cool. – JVE999 Apr 03 '20 at 16:41