Im Korean. So understand not good at English.
I have problem using Blueprint function “Play Slot Animation”
This is My Character BP.
And this is Character’s simple ABP.
Only play slot animation.
And this Montage using group ‘1’ and using slot ‘2’.
Nothing happens when I press Z,
And i modify asset parameter, Slot Node Name to 1.2, It also do not work.
So What should I do? What is Problem?
This might be a little late but for posterity’s sake I figured I would answer this question.
PlaySlotAnimation() and PlaySlotAnimationAsDynamicMontage() are a bit strange because the Asset parameter is of the UAnimSequenceBase class, but the function name suggests that you pass it an animation montage (UAnimMontage) and it plays a slot in that montage. When in reality what actually happens is that the function is expecting an animation sequence to use to create an animation montage, and the slot name you pass it is the slot name in the new dynamically generated montage. In fact the first check in the code is to see that it is NOT an animation montage:
bool bValidAsset = Asset && !Asset->IsA(UAnimMontage::StaticClass());
So if you pass in an animation montage, the asset will always be marked as NOT valid and the function will exit.
In other words, you can’t use PlaySlotAnimation() or PlaySlotAnimationAsDynamicMontage() to play a slot in an animation montage that already exists. You’ll just have to create multiple animation montages and use MontagePlay() to play them.
This is a bit of a strange design decision, if someone from Epic could clarify as to why there is not a function to play an animation from an existing montage that would be awesome; maybe I just missed it? The function naming is poor though IMO, something like PlayDynamicMontage() may have been better. I would be interested to hear someone else’s thoughts though.
(Referencing code at ea7b5e4da1ca360c4800fc11f1125c3c38f68f12, which is on the 4.19 branch)