How to dynamic load and play animation

I’m trying to dynamic load and play animation,
this is my code

UAnimMontage*ani1 = LoadAnimMontage("/Game/FirstPerson/Animations/FirstPersonFire_Montage.FirstPersonFire_Montage");
	FName ske("/Game/FirstPerson/Character/Mesh/SK_Mannequin_Arms_Skeleton.SK_Mannequin_Arms_Skeleton");
	USkeleton*skeletal = Cast<USkeleton>(StaticLoadObject(USkeleton::StaticClass(), NULL, *ske.ToString()));
	ani1->SetSkeleton(skeletal);

	FName anis("/Game/FirstPerson/Animations/FirstPerson_JumpLoop.FirstPerson_JumpLoop");
	UAnimInstance*animIns = Cast<UAnimInstance>(StaticLoadObject(UAnimInstance::StaticClass(), NULL, *anis.ToString()));


testMeshCom3->SetSkeletalMesh(myMesh3);

//testMeshCom3->AnimScriptInstance = animIns;

testMeshCom3->AnimScriptInstance->Montage_Play(ani1);

but I got AnimScriptInstance as NULL, did I miss something?

now I use PlayAnimation function , it worked. :slight_smile:
FName anis("/Game/FirstPerson/Animations/FirstPerson_JumpLoop.FirstPerson_JumpLoop");

	UAnimationAsset*animIns = Cast<UAnimationAsset>(StaticLoadObject(UAnimationAsset::StaticClass(), NULL, *anis.ToString()));

testMeshCom3->PlayAnimation(animIns, true);