#Input System problem (TRIGGER WARNING: I'M NEW)

1 messages · Page 1 of 1 (latest)

cloud cove
#

This is the code:

#

using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
Rigidbody2D rb;

void Awake()
{
    rb = GetComponent<Rigidbody2D>();
}

void FixedUpdate()
{
    if (Keyboard.current.upArrowKey.isPressed)
    {
        rb.AddForce(transform.up);
        Debug.Log("W");
    }
}

}

#

It doesn't Debug.Log W

#

I followed an tutorial

silent pelican
#

!code

full torrentBOT
silent pelican
#

also what button are you pressing on your keyboard

cloud cove
#

The UpArrowKey

#

wait imma make the code

#
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerMovement : MonoBehaviour
{
    Rigidbody2D rb;

    void Awake()
    {
        rb = GetComponent<Rigidbody2D>();
    }

    void FixedUpdate()
    {
        if (Keyboard.current.upArrowKey.isPressed)
        {
            rb.AddForce(transform.up);
            Debug.Log("W");
        }
    }
}
It doesn't Debug.Log W
I followed an tutorial
silent pelican
#

is the component attached to an active object in the scene

cloud cove
#

The RigidBody2D is attached to the main plaer ( a rocket ) .

silent pelican
#

that's not what i asked. i asked about this component

cloud cove
#

OHHH

#

THE SCRIPT ISNT ATTACHED

silent pelican
#

!learn 👇 start by learning how to actually use the engine instead of skipping ahead to tutorials that don't teach you the absolute basics

full torrentBOT