- Home /
New Input System and how to use it
Few questions about how to use new Input System.
The first example and question: Is it safe to store ctx in floats/vector2 and use them in other functions, also in the fixed update?
(this is just a part of code)
void Awake(){
myControls = new Controls();
myControls.Player.Move.performed += HandleMove;
}
private void HandleMove(InputAction.CallbackContext ctx)
{
valueX = ctx.ReadValue<Vector2>().x;
valueY = ctx.ReadValue<Vector2>().y;
}
private void MoveForFixed(){
rb.velocity=new Vector2(valueX*speed,valueY*speed);
}
void FixedUpdate(){
MoveForFixed()
}
The second question is about processing events. Go to project settings->Input System Package.
There is Update mode, by default it is Dynamic Update, what If is set to Process Events in Fixed Update. Usually, when getting input from Fixed Update, you will miss input and that is why Input detection was in Update(old input system), so is here something different, what is the usage and benefit from Process Events in Fixed Update.
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612231457im_/https://answers.unity.com/themes/thub/images/avi.jpg)