Question by
ryansanchezmail · Sep 09, 2020 at 07:08 AM ·
movementinput
Can Someone Help me With Some Input Issues?
I'm trying to get a character controller working, but for some reason, nothing I do is working. I'm using the Input System plugin. Here's my code:
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
public class ControlsScript : MonoBehaviour
{
private Controls _controls;
[SerializeField] private float speed = 5f;
private Vector2 currentPosition;
void OnEnable()
{
_controls.Enable();
}
private void OnDisable()
{
_controls.Disable();
}
void Awake()
{
_controls = new Controls();
}
private void FixedUpdate()
{
// Read Movement Value
float movementInput = _controls.PlayerLand.Move.ReadValue<float>();
// Movement
Vector3 currentPosition = gameObject.transform.position;
currentPosition.x += movementInput * speed * Time.deltaTime;
gameObject.transform.position = currentPosition;
}
}
Here's a screenshot of my input asset:
It hasn't worked with any of the input methods I've tested.
It's rather simple code, I'm just wondering at this point if I'm missing anything. Any help would be appreciated!
screenshot-from-2020-09-08-20-43-50.png
(83.1 kB)
Comment