How to include and use UPlayMontageCallbackProxy::CreateProxyObjectForPlayMontage in C++?

I want to play my UAnimMontage via C++, and in particular, want to make use of the conveniences of UPlayMontageCallbackProxy.

Looks like in theory, I can use UPlayMontageCallbackProxy::CreateProxyObjectForPlayMontage, but anytime I use it, I just get linker errors:

0>YCharacterVaulting.cpp.obj: Error LNK2019 : unresolved external symbol "public: void __cdecl UPlayMontageCallbackProxy::PlayMontage(class USkeletalMeshComponent *,class UAnimMontage *,float,float,class FName)" (?PlayMontage@UPlayMontageCallbackProxy@@QEAAXPEAVUSkeletalMeshComponent@@PEAVUAnimMontage@@MMVFName@@@Z) referenced in function "public: void __cdecl UYCharacterVaulting::Traverse(void)" (?Traverse@UYCharacterVaulting@@QEAAXXZ)

I’ve already updated my Build.cs so that the module is included:

PrivateDependencyModuleNames.AddRange(new string[] {"AnimGraphRuntime", "MotionWarping"});

Any ideas on how I can fix the linker error? Thank you!

2 Likes

PublicDependencyModuleNames.AddRange(new string[ ] { “AnimGraphRuntime” });

Hi,
I’ve faced the same issue with the same class. My project was compiled successfully but there was that type of linker error in VC 2022. Apart from regural UE set ups for new modules(.Build.cs or ,Target.cs), make sure that Visual Studio sees your include files. Right click on your project -> Properties, under Configuration Properties find VC++ Directories -> General -> Include directories. Make sure there is file path with your .h included. If not, then add it. Then Apply, OK.

I hope it helps somobody.