Hello.
I have some variable TEST_AnimSeq with type Anim Sequence and some Anim Assets.
I want to call SET for this variable and pass into that variable some Anim Sequence by name, for example, by name as String ‘Dawn-01’.
How can I get Animation Asset by it’s name as String?
Thank you!
Solved!
It’s very simple - just use TObjectIterator ( A new, community-hosted Unreal Engine Wiki - Announcements - Epic Developer Community Forums ).
Example:
UAnimSequence* UFurnitureLib::GetAnimSequenceByName(FString Name) {
UAnimSequence *uas = nullptr;
for (TObjectIterator<UAnimSequence> Itr; Itr; ++Itr)
{
FString f = Itr->GetName();
if (f.Contains(Name) && Itr->GetClass()->GetName().Contains(TEXT("AnimSequence"))) {
GEngine->AddOnScreenDebugMessage(-1, 5.f, FColor::Green, TEXT("!!! " + Itr->GetClass()->GetName() + " *** " + Itr->GetName()));
uas = *Itr;
}
}
return uas;
}