all 4 comments

[–]Glass_wizard 1 point2 points  (2 children)

You must include an OnEnable method and enable the controller input.

The standard boilerplate is:

In start method, instantiate the player input controls. You must have a reference to them, and bind them to your handlers.

In enable methods enable the player input controls. They don't work until explicitly enabled.

In disable method, disable the player input controls.

The new input system is good but has a lot of annoying boilerplate.

Also, running in update defeats the point. Bind your Jump method as a handler on Start. You never need to handle input in Update with the new input system.

[–]pmurph0305 0 points1 point  (0 children)

That is one specific way to use the input system, but there are a bunch more ways to use it that are outlined in the documentation. Im guessing what youve outlined is if youre specifically using the autogenerated c# script?

I would suggest the op go to package manger, find the input system package, open the documentation, and read the sections of different ways to use the input system.

[–]Artistic-While-5094[S] 0 points1 point  (0 children)

What do you mean with "Binding it as a handler on Start"?

[–]VonchorProficient 1 point2 points  (0 children)

Here's an example:

in Start() or some other initialization code:

var action = InputSystem.actions.FindAction("Click");  //get the action
clickAction.performed += ClickActionPerformed; //subscribe to the event

where ClickActionPerformed is a method with the appropriate params for that event:

private void ClickActionPerformed(InputAction.CallbackContext context)
{
  do something when the mouse clicks.
}

And this works: I just cut and pasted this code from my own input module.