SetAnimation<public>(Keyframes:[]keyframe_delta, ?Mode:animation_mode) does not accept a value from the animation_mode enum for the second parameter.

I am trying to call this function from the animation_controller class:

SetAnimation<public>(Keyframes:[]keyframe_delta, ?Mode:animation_mode):void = external {}

I am having trouble passing a value for the second parameter, ?Mode:animation_mode

It is for the ENUM animation_mode

animation_mode<native><public> := enum:

        OneShot
        
        PingPong
        
        Loop`

Here’s how I tried calling it
AnimationController.SetAnimation(Keyframe, animation_mode.OneShot)
ERROR:

  • Expects: tuple([]keyframe_delta,?Mode:animation_mode)
  • Given: tuple[(]keyframe_delta,animation_mode)

Then, someone suggested I wrap it in a option{}, but alas not working.
AnimationController.SetAnimation(Keyframe, option{animation_mode.OneShot})
ERROR:

  • Expects: tuple([]keyframe_delta,?Mode:animation_mode)
  • Given: tuple[(]keyframe_delta,?animation_mode)

I believe someone answered you in this topic Putting the optional operator in a function before the parameter's name makes the function uncallable. - #2 by t.tutiya

I had originally posted this as I thought it was a bug with the function. But after further testing it was a bug with the optional operator.

Now that post you are referencing was removed for “off topic” before I got the chance to read the response.

Do you know what they said?

I believe it’s me who flagged this because it wasn’t a bug. Didn’t know they would remove it though.

So basically, you’re just not using it right, you have to call

AnimationController.SetAnimation(Keyframe, ?Mode := animation_mode.OneShot)
1 Like

THANK YOU!!! It now compiles…now to figure out how to generate keyframes for my animation.

2 Likes