# UInputMappingContext\* variable init way ?

**URL:** <https://forums.unrealengine.com/t/uinputmappingcontext-variable-init-way/876984>\
**Category:** C++\
**Tags:** unreal-engine, CPP\
**Created:** [April 8, 2023, 12:29am UTC](https://forums.unrealengine.com/t/uinputmappingcontext-variable-init-way/876984 "2023-04-08T00:29:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![soimrandy](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@soimrandy](https://forums.unrealengine.com/u/soimrandy)\
**Post date:** [April 8, 2023, 12:29am UTC](https://forums.unrealengine.com/t/uinputmappingcontext-variable-init-way/876984/1 "2023-04-08T00:29:08Z")

</div>

i want to initiate an UInputMappingContext\* variable with an asset of the same type but i couldn’t find the c++ code to do it

| | static ConstructorHelpers::FObjectFinder mapping(TEXT(/Game/control.control)); |
| --- | --- |
| | UInputMappingContext\* MappingContext = mapping.Object; |
| | if (MappingContext != nullptr) |
| | { |
| | //ConstructorHelpers::ValidateObject(static\_cast\<UInputMappingContext\*\>(MappingContext), \*mapping.GetFullName(), TEXT(/Game/control.control)); |
| | DefaultMappingContext = MappingContext; |
| | } |

this is the code i used
