Intellisense Not Recognizing Data Type

I am new to both C# and Unity. Very new.

I created a new C# script and I'm trying to add the following line:

public Vector3 direction = Vector3.up

When I go to type in Vector3, my only option that has anything with Vector in it is "BitVector32".

I am using a 3D object in Unity.

What do I need to do?

Edit: I am using the following:

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

Edit:

  1. I have confirmed Visual Tools for Unity is installed.
  2. I am using UnityEngine at the top.
  3. Below is the code I am using. All I am trying to figure out is why

intellisense does not recognize Vector3 sense it is a data type. It recognizes "BitVector32" but not "Vector3" though, when I run this code, everything works fine.

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

public class Mover : MonoBehaviour
{
    // Vector3 is unique to UnityEngine

    public Vector3 direction = Vector3.up;

    float speed = 0.1f;

    void Update()
    {
        var movement = direction * speed;

        this.transform.Translate(movement);
    }
}

Upvotes: 0

Views: 387

Answers (3)

MikkMods
MikkMods

Reputation: 26

I may be a little late to this, but I've had the same problem. What worked for me was to go in Unity, go to the top left and select Edit->Preferences and open the External Tools tab. In there the first option should be External Script Editor. Make sure you've selected Microsoft Visual Studio 20xx. Intellisense should get a hold of Unity specific objects and data types and be able to recognise things like Vector3.

Upvotes: 1

S.A.Parkhid
S.A.Parkhid

Reputation: 2870

Does your IDE understand other keywords such as Input or Application? if it does not recognize those, try to install Unity Games Development Tools from visual studio installer. also, Jetbrains Rider is another IDE that is very useful for Unity developers.

Upvotes: 1

IndieGameDev
IndieGameDev

Reputation: 2974

I would check if you have included using UnityEngine;

Upvotes: 2

Related Questions