Can't load AnimMontage in Android device using C++

When use LoadObject to load Montage object, LoadObject always return NULL in Android device, but it works fine in Windows Editor.

UAnimMontage* AnimMtgAkt01 = LoadObject<UAnimMontage>(NULL, TEXT("AnimMontage'/Game/Mannequin/Rex/Rex_AnimMtg_Attack01.Rex_AnimMtg_Attack01'"));

By the way, LoadObject always return NULL when running on Client(NetMode is NM_Client) in Windows device. UE4 version is 4.16

Hello,

This seems like something that is caused by the asset not being cooked into the project. This could be due to the references being made to it. If you are calling the line of code you posted on construction on a class that is being referenced by a map that you are cooking, it should be included automatically. I had this work correctly on both Windows and Android placing a Blueprint of the following class in the map: Pastebin.

However, if it is being called somewhere like BeginPlay, the editor doesn’t recognize that this asset is ever being referenced in the maps that are being cooked so it doesn’t cook it into the package. If this is the case, you can fix this by adding the asset’s folder to the “Additional Asset Directories to Cook” in Project Settings > Packaging under the expanded settings. This will force the asset to be cooked even if it isn’t being referenced.

Thx for your reply, but it doesn’t work, even I added “Additional Asset Directories to Cook” and checked “cook everything in the project content directory”, LoadObject always return NULL in BeginPlay function.
If LoadObject in Construct of MyUserWidget, Server would crash when startup
I uploaded log file of Server when startup
link text

UPVPWidget::UPVPWidget(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer)
{
	AnimMtgAkt01 = LoadObject<UAnimMontage>(NULL, TEXT("AnimMontage'/Game/Mannequin/Rex/Rex_AnimMtg_Attack01.Rex_AnimMtg_Attack01'"));
	AnimMtgAkt02 = LoadObject<UAnimMontage>(NULL, TEXT("AnimMontage'/Game/Mannequin/Rex/Rex_AnimMtg_Attack02.Rex_AnimMtg_Attack02'"));
	AnimMtgSkill01 = LoadObject<UAnimMontage>(NULL, TEXT("AnimMontage'/Game/Mannequin/TestModel/AnimMtgAttack_02.AnimMtgAttack_02'"));
}

By the way, it works fine with the same source when running in version 4.15. but it failed with 4.16 .

I apologize for the delay on this but I’m not able to reproduce the issue. Could you provide a sample project that reproduces this problem?

That’s all right. I have uploaded project that can reproduce issue on box:Box

4.16.2 has fixed this issue.