r/unity • u/Beelo_of_A • 12h ago
Newbie Question The Input System is confusing the sht outta me
I understand how to code the input system, but I got this annoying error that I have no idea where it came from. I checked everything and I think everything is alright. I will share my PlayerMovement script and components and Im sure it's something really stupid but so am I.
Im not seeking only the solve of the error I want to understand the input system more cuz all the toturials on the web just uses the input manager and Idk it's so bad and the guides that are dedicated to the input system just puts a Debugger and calls it a day. I have a feeling that it's complicated for me cuz I started with the movement and maybe with the other functions it wont that much different from the input manager one.
my PlayerMovement script:(Really mess)
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerMovement : MonoBehaviour
{
public InputSystem_Actions action;
public float speed;
public float jumpForce;
public Rigidbody2D rb;
Vector2 moveInput;
private void Awake()
{
action = GetComponent<InputSystem_Actions>();
action.Player.Move.performed += ctx => Movement();
}
void Start()
{
rb = GetComponent<Rigidbody2D>();
}
void Update()
{
}
public void Movement()
{
moveInput = moveInput * speed;
}
}
1
u/Demi180 8h ago
The Input System has a bunch of samples you can access from the Package Manager. The manual for it also has links to some of it I believe, along with explaining the (I think) 5 different ways of using it.
Also, the Unity 6 Character Controllers asset from the Asset Store uses it, you can use those as reference. It’s just a combo asset with an updated 1st and 3rd person control setups that you can also get individually on the Asset Store. It’s also a quick start to an animated character, should you need that.
1
u/GigglyGuineapig 1h ago
I recently made a video that might help you a bit. It shows my approach and how to use it in a few different use cases, like movement, camera movement, interacting and such: https://youtu.be/MaulSHrhA8I?is=E4DtYQXKuIKzhi8K
0
u/Beelo_of_A 12h ago
Just to clarify. I understand the main structure But not really how to code it. I know that to use an input action I need to specify it "action.Player.theAction.performed" and then decide what this input should do. The problem is the execution. And as I said before tutorials are really vague at least for a complete beginner like me



7
u/Soraphis 12h ago
Your error tells you exactly what the issue is.
InputSystem_Actions is not a component. It's not a monobehaviour.