22.5 C
New York
Wednesday, October 1, 2025

second – Cannot Get Unity New Enter System To Work


For context I’m very a lot a newbie.

I’ve been attempting to get the participant to maneuver utilizing Unity’s new Enter System following this tutorial. It is solely a yr previous and others within the feedback appeared to have figured it out okey; some folks have had troubles like me although. I adopted the tutorial once more very intently and couldn’t see that I did something improper. I’ve beforehand been ready to make use of Unity’s previous Enter System properly however by no means tried this one.

I opened and closed Unity, and uninstalled after which reinstalled the brand new Enter system. I made positive that the settings have been set to make use of each legacy and new Enter.

I’m not receiving any errors within the script or console.

Screenshot of settings:

Code:

utilizing UnityEngine;
utilizing UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
    personal float moveSpeed = 5;
    personal Rigidbody2D rb;
    personal Vector2 moveInput;

    // Begin is named as soon as earlier than the primary execution of Replace after the MonoBehaviour is created
    void Begin()
    {
        rb = GetComponent();
        
    }

    // Replace is named as soon as per body
    void Replace()
    {
        rb.linearVelocity = moveInput * moveSpeed;
      
    }

    public void Transfer(InputAction.CallbackContext context)
    {
        Debug.Log("Perform referred to as.");
        moveInput = context.ReadValue();

    }
}
 

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles