Is there any way to force a “recheck” for the inputs in the controller or the pawn?
I would like to know which keys where pressed before possession to apply them once possession happens (no pawn yet) or when the controller doesnt exist.
This “recheck” means: “See what keys the player is pressing currently and apply all the actions that belong to those keys”. I looked at PreProcessInput to call it on beginplay or postinitialisecomponents but it gave no results. Any idea?
Hey there, what is the time window that you want to “recheck” the inputs that were pressed? A way of doing it is to have the inputs all in the player controller and if you have a valid pawn then you reroute those to the pawn to handle, if it’s not valid you can store them in an array of inputs. when you possess the pawn you loop through the array and call the corresponding functions in the newly possessed pawn.
I just need to check the inputs on possesion on my pawns.
About doing that on PC, what if it’s invalid? The objective is if you hold shift at the menu screen, and you keep it pressed after starting the game and going through loading screen or server travel, having the action executed at the begining of the match without having to repress the key. I was looking for something that will refresh the key stack as soon as the pawn is possesed.
If you want to maintain the key state through loading screens and server travels you might want to have some variables in the game instance because that persists over all of that. So when you press the shift key you tell the game instance variable array is pressed, if you release it you tell it that is not pressed anymore. You could try to do a Is Input Key Down on the begin play of the pawn but i’m not sure if that works since the player controller will be recreated after the key was pressed.
No that doesn’t work, the main fact about why not to store it on the gameinstance is because the state of the key might change while the controller is nullptr and said input will be ignored hence the variable will be “stuck in a value”.
I through the engine had something like ‘‘APlayerController::ForcePlayerInputStackRefresh()’’, I was looking through UGameViewportClient class and it seems persistant, but i don’t think would be a good idea to delegate every single input coming from that class to the controller or the pawn