- Home /
unity or Vs not recognizing code
So i followed a tutorial about 3rd person movement and it won't work unity won't run it and nothing is being registered Here is the code please help me out with this.
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class thirdpersonmovement : MonoBehaviour {
public CharacterController controller;
public float speed = 6f;
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxisRaw("horizontal");
float vertical = Input.GetAxisRaw("vertical");
Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;
if (direction.magnitude >= 0.1f)
{
controller.Move(direction * speed * Time.deltaTime);
}
}
},So i was following a tutorial about how to do a 3rd person camera and i'm pretty sure i followed it nearly perfect but the program just won't work. the code isn't being recognized. Please help me with this here is the code below
using System.Collections; using System.Collections.Generic; using UnityEngine;
public class thirdpersonmovement : MonoBehaviour {
public CharacterController controller;
public float speed = 6f;
// Update is called once per frame
void Update()
{
float horizontal = Input.GetAxisRaw("horizontal");
float vertical = Input.GetAxisRaw("vertical");
Vector3 direction = new Vector3(horizontal, 0f, vertical).normalized;
if (direction.magnitude >= 0.1f)
{
controller.Move(direction * speed * Time.deltaTime);
}
}
}
Answer by TomatJuice · Jul 07, 2020 at 11:14 AM
Go to Edit > Preferences > External Tools and then make sure External Script Editor is set to Visual Studio or VsCode.
Your answer
