I am using a tutorial by Natty gamedev and encountered this issue in the first tutorial am using newest recommended version of unity
I am also new to gamedev and unity in general
the exact error message is
Assets/Scripts/PlayerMotor.cs(26,33): error CS1061: ‘Vector2’ does not contain a definition for ‘t’ and no accessible extension method ‘t’ accepting a first argument of type ‘Vector2’ could be found (are you missing a using directive or an assembly reference?)
my code is as follows am using a youtube tutorial
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
private CharacterController Controller;
private Vector3 PlayerVelocity;
public float speed = 5f;
// Start is called before the first frame update
void Start()
{
Controller = GetComponent<CharacterController>();
}
// Update is called once per frame
void Update()
{
}
//recieve the inputs for our InputManager.cs and apply them to out character controller.
public void ProcessMove(Vector2 input)
{
Vector3 MoveDirection = Vector3.zero;
MoveDirection.x = input.x;
MoveDirection.z = input.t;
Controller.Move(transform.TransformDirection(MoveDirection) * speed * Time.deltaTime);
}
}
and my second script is
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class InputManager : MonoBehaviour
{
private PlayerInput PlayerInput;
private PlayerInput.OnFootActions OnFoot;
// Start is called before the first frame update
void Awake()
{
PlayerInput = new PlayerInput();
OnFoot = PlayerInput.OnFoot;
motor = GetComponent<PlayerMotor>();
}
// Update is called once per frame
void FixedUpdate()
{
//tell the playermotor to move using the value from our movement action.
motor.ProcessMove(Onfoot.Movement.ReadValue<Vector2>());
}
private void OnEnable()
{
OnFoot.Enable();
}
private void OnDisable()
{
OnFoot.Disable();
}
}
the error comes from the first script but maybe second one is also needed to fix error
i tried looking if i have any spelling mistakes
i also tried searching online couldn’t find anything
maybe the tutorial is outdated
user26454620 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.