So yeah, I started learning the new input system today. I’ve tried to troubleshoot and follow tutorials exactly already but I can’t seem to figure it out.
.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class Player : MonoBehaviour
{
public Rigidbody rb;
Player_Input controls;
float moveSpeed = 0.25f;
Vector2 moveDirection;
// Start is called before the first frame update
void Awake()
{
controls = new Player_Input();
controls.Gameplay.Movement.performed += context => moveDirection = context.ReadValue<Vector2>();
controls.Gameplay.Movement.canceled += context => moveDirection = Vector2.zero;
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void Update()
{
}
public void player_Move()
{
Vector3 tmpVector3 = new Vector3(moveDirection.x,0f,moveDirection.y);
rb.MovePosition(transform.position + tmpVector3);
}
void OnEnable()
{
controls.Gameplay.Enable();
}
void OnDisable()
{
controls.Gameplay.Disable();
}
}
So when the engine is running, the gameobject moves once, then stops no matter how long you hold down the button. When I had a controller added, it did the same thing. It would move if you changed direction(once per analog direction change) but keeping any direction held would result in a standstill. It acts like it’s “GetKeyDown” rather than “GetKey.” I’ve tried different inputs, movement types, keys, action and control types, etc.
The official doc had some information but I thought it was kinda broad and didn’t help really. I’ve followed a few different tutorials exactly. A lot of the Information that I’ve found so far has been kinda…meh. Or rather, they just completely leave out some stuff entirely or doesn’t explain what they are doing or why they are doing it that way.
Anyway, am I just a dummy and doing something wrong or is this a weird bug?

