I can assign Input Mapping Context and Input Actions to my objects through the relevant Blueprint fields.
At the moment, I have a class for which I don’t want to have a blueprint. Is there a way to load the IMC in the constructor like below:
UInputMappingContext* MY_IMC{ nullptr };
// ATTEMPT 1:
static ConstructorHelpers::FObjectFinder<UInputMappingContext> MY_IMC_RESOURCE(TEXT("PATH"));
MY_IMC = MY_IMC_RESOURCE.Object;
// ATTEMPT 2:
MY_IMC = Cast<UInputMappingContext>(StaticLoadObject(UInputMappingContext::StaticClass(), NULL, TEXT("PATH")));
Normally I can load audio and meshes directly through C++ via these approaches, without using any BPs. But these methods generate errors when used for loading IMC.
So, my question is: Is there a way to load IMC in C++? Or is it mandatory to use blueprints to assign IMC?