So I’m trying to make my PlayerController change input mapping contexts based on the type of pawn I’m possessing.
However, when I call ClearAllMappings and/or AddMappingContext during On Possess, this will break input consumption - by that I mean the mapping context is indeed set correctly but I will not receive any input events anymore (breakpoints on them do not trigger).
This sample code will reproduce this for me:
(will always print “Has Main Context”)
What’s so confusing is that calling the same nodes in the same manner during On Begin Play will not break input consumption. I can abstract them away into a function or custom event and that doesn’t change the behavior - if those nodes are called from On Possess, input breaks down completely.
I have no clue what to even do about this. I’ve checked the C++ sources for Enhanced Input but I do not see any special cases for that particular BP event (not surprised).
How, … what? Is this a bug in UE5.1?
//edit: A kind soul on discord found the solution: Adding a call to the parent of On Possessed before my code fixed the problem.