AnimationSlot bug?

I am testing on how to use “Animation Slot” in Flax,
Please look at my test result and tell me if I am doing things wrong,
or is there a bug inside AnimationSlot feature?

Setup

  1. Create AnimatedModel

  2. Create AnimGraph, like this
    just a simple AnimationSlot connected to Animation Output pose, without any Animation attached to it. We will call the Animation by Script

  3. Create C# Code and attach to the AnimatedModel above

public class AnimSlotTest : Script
{
    //PUBLIC
    public Animation      animIdle      = null;      //Anim : IDLE

    //PRIVATE
    private AnimatedModel m_Model       = null;
    private int           m_sCounter    = 0;

     //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    /// <inheritdoc/>
    public override void OnStart()
    {
        m_Model = Actor.As<AnimatedModel>();
    }
        
    /// <inheritdoc/>
    public override void OnUpdate()
    {
        _PlayAnim();
        
    }

    //@Brief : Process Animation by script
    private void _PlayAnim()
    {
        //Error Check
        if (m_Model == null)
            return;

        //Process
        string pSlotName = "CustomSlot";
        if (!m_Model.IsPlayingSlotAnimation(pSlotName, animIdle))
        {
            //Play Animation with LoopCount = -1 (infinite loop)
           m_Model.PlaySlotAnimation(pSlotName, animIdle, 1.0f, 0.2f, 0.2f, -1);

           //Show Log in Console 
           Debug.Log($"AnimSlot : {pSlotName}, {m_sCounter}\nPlay anim {animIdle.Path}");

           //Iterate Counter to see howmany times we call "PlaySlotAnimation()"
           m_sCounter ++;
        }
    }

}

Basically the code will play “animIdle” in a forever loop (loopCount=-1) Animation at AnimationSlot=“CustomSlot”, if the Slot is not playing animation.

  1. Test Result
    anim_slot_
  • The “PlaySlotAnimation()” is called 3 times :
    1st time (m_sCounter=0) → no animation played
    2nd time (m_sCounter=1) → animation played, but somehow not looped although we set loopCount=-1
    3rd time (m_sCounter=2) → animation played correctly with loopCount=-1

Expected Result
I expected the code to just call “PlayAnimationSlot()” once, but it is called 3 times,
I kind of understand if the first time the Animation is not registered yet, so IsPlayingAnimationSlot() give a false result, but the 2nd time is weird because it does not play the correct parameter I set in the function.
Is this a bug?

Please report this on Issues · FlaxEngine/FlaxEngine · GitHub so we can track it and fix it there.

Posted Git Issue here :