In short i want some sort of variable from montages that describe either the names of the sections or just a number telling me how many sections is in a montage.
My purpose for doing this is quite simple i want to randomize which animation play, say i got 6 sections and i want to randomize 3 of them to be random.
If anyone has a better idea for this please share, i am all ears.
I solved it like this (dirty hack):
if (GuardIdleMontage != NULL)
{
FString result;
int index = -1;
do
{
result = GuardIdleMontage->GetSectionName((index+1)).ToString();
index++;
} while (result != "None");
if (index > 0)
{
NumMontageSections = index;
}
}
Hey, thanks for the solution. However, there is an easier way:
int32 GetNumMontageSections(const UAnimMontage* montage)
{
if (montage == nullptr)
return 0;
return montage->CompositeSections.Num();
}
1 Like