Does the AddMappingContext Node overwrite a previous priority value?

Im currently trying to implement a slide by using a sprint Input Mapping Context. Im wondering if the AddMappingContext Node overwrites the priority value if i add the same context again?

Current code:

Wondering if i should use RemoveMappingContext instead of AddMappingContext with
priority = -1 when toggling sprint mode off.

Thanks in advance :slight_smile:

the “priority” value is used by the engine as a kind of “check in this order from low to high” meaning that if you register multiple Mapping Contexts with the same priority; 1 of 2 things can happen either:

  • Input Actions bound to the same button in different mapping contexts (marked as “consume input”) will be fired in the order the Mapping Contexts were registered (meaning if the input is marked “consume input” then the input will never get to the second Mapping Context to be read)

Or

  • given that Arrays can have almost random ordering at times, it could be either of the Mapping contexts getting it first.

Remove Mapping Context is safe to use even if the given Mapping Context is not registered, and Add Mapping Context is safe to use with “None” selected.

onto the logic itself, if controls do not change in a meaningful way between your “sprint” and “not Sprint” then does this need to be a separate Input Mapping Context?

Thnx :slight_smile: And yea i also kinda noticed it was a bit overkill since my controls didnt really change that much :stuck_out_tongue: So i ended up just implementing it with a bool that checks if im sprinting, when crouch is hit.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.