Input Handler
In UE, a class called Interaction represents the input handler. It has three delegate functions for scriptors to get input events:
- OnReceivedNativeInputKey
- OnReceivedNativeInputAxis
- OnReceivedNativeInputChar
Input Handler Chain
The following picture shows the input handlers and the class hiearchy in UE:
- Console: This is the console which pops up when you press the Tilde key.
- GFxInteraction: This is for the UI based on Scaleform GFx.
- UIInteraction: This is for the old UI system.
- PlayerManagerInteraction: This passes input events to PlayerInputs within PlayerControllers.
- Input: This supports the key binding feature in UE.
- PlayerInput: Object within PlayerController which is responsible for tracking player input.
The main input handler chain is stored in an array named GlobalInteractions within GameViewportClient. Console, GFxInteraction, UIInteraction, and PlayerManagerInteraction are inserted to the handler chain in the Init function. You can add your own input handler by calling InsertInteraction(). Besides, you can also use the input delegates in GameViewportClient, which are called before GlobalInteractions.
Moreover, there is another input handler chain stored in the Interactions array within PlayerController. In PlayerController's InitInputSystem(), it will insert a PlayerInput into its Interactions. The forementioned PlayerManagerInteraction will pass recieved input events to the Interactions in PlayerController. That's how PlayerInput gets input. So next time when you have troubles with input events, you might check the handler chain first to see what's going wrong.
0 comments :
Post a Comment