- Home /
Vector3 Error - "The type or namespace 'Vector3' could not be found."
This is my code:
using UnityEngine;
using System.Collections;
public class Player2 : MonoBehaviour {
public float speed = 1f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (Input.GetKey (KeyCode.D))
transform.position += new Vector3 (speed * Time.deltaTime, 0.0f, 0.0f);
if (Input.GetKey (KeyCode.A))
transform.position -= new Vector3 (speed * Time.deltaTime, 0.0f, 0.0f);
if (Input.GetKey (KeyCode.W))
transform.position += new Vector3 (0.0f, speed * Time.deltaTime, 0.0f);
if (Input.GetKey (KeyCode.S))
transform.position -= new Vector3 (0.0f, speed * Time.deltaTime, 0.0f);
}
}
It then asks me: "Are you missing a using directive or an assembly reference?" I don't know what any of this means, please help!
Comment
try to restart both unity and monodevelop. It should work.
Yup, something has derped hard. Copy-pasting your code yields no errors, so it's definitely your Unity that's going crazy.