How to use "Get Mapping Contexts" node?

Ok, I’m trying to have a “scene” that is separated from the gameplay.
I want the “scene” to be modular, so I have a specific Input Mapping Context(IMC) for it.
To change it:

I want to store all other active IMCs, deactivate them and then add the “scene” IMC.

After I’m done with the “scene” I want to remove the “scene” IMC and reactivate the old ones.

To do that I was trying to use the node “Get Mapping Contexts” to get all other active IMC since I want the “scene” to be modular I won’t be looking for specific a specific IMC like this:

The “Get Mapping Contexts” node needs a target input called “Player Mappable Input Config” but I have no idea on how to get this.

You can get the target by getting the Player Controller and from it get the Enhanced Input Local Player Subsystem like so.

That doesn’t work, it needs a “Player Mappable Input Config” as a target not an “Enhanced Input Local Player Subsystem”.

Can’t you get it from the player controller also?

I can’t… Even when I untick “Context Sensitive” from the RMB Context Menu the only thing that shows up is a cast for it. But I don’t know what to stick in it anyway.

From what i can see you can get it from the "Enhanced Input Local Player Subsystem, but im not sure how to guide you from here.
Hope that helps.

I don’t think that, for now at least, you can get a list of all the Input Mapping Contexts (IMCs).

https://docs.unrealengine.com/5.2/en-US/BlueprintAPI/Input/MappingQueries/

But if the Player always uses the same IMC by default and only the “scene” one is specific and you want that to be modular you could promote the IMC that “scene” uses to a variable, expose it and set it like you want on the different “scenes” you have in your world.

On my current project I have setup a way to switch Pawn. Each possessable Pawn has an Actor Component with this logic in it:


In each Pawn I can set up what IMC to use, and since the default Pawn will always use the Default IMC I don’t have to expose this one.

Hope that helps in some way…

Yeah, that’s what I assumed… I set a simple add context on posses and a remove all contexts on unposses to both of them. Not really modular but it’s minimal.
I really hope there is a way to get all contexts in the future.

2 Likes

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