I am attempting to use the AnimationController.setAnimation() function but I am getting an error on the second argument.
ERROR: This function parameter expects a value of type tuple([]keyframe_delta,?Mode:animation_mode), but this argument is an incompatible value of type tuple([]keyframe_delta,animation_mode).
tuple([]keyframe_delta,?Mode:animation_mode)
tuple([]keyframe_delta,animation_mode)
How do I deal with an (what I assume) optional parameter?
This is how i am calling it. AnimationController.SetAnimation(Keyframe, animation_mode.OneShot)
You need to put your value inside option{}. for example consider the function: Foo(Val: ?float): void = {}
In that case, when you call it you’ll write it this way: Foo(option{5.7}) and not Foo(5.7)
It seems that the second parameter of this function is an optional parameter. To fill an an optional parameter in a function, you’ll need to write it this way: ?Mode:= option{animation_mode.OneShot}
A brief example is this: Print(“Hello, world!”, ?Duration:= 0.35)
Optional parameters in functions indicates that this parameter has an already assigned value and can be overridden by user whenever needed unlike required parameters
Just to expand on that, you need to use the optional parameters full exact name (with a ‘?’ before it) as written in the function before the default value.
I wrote some of these myself and struggled hard before I figured that out. Just figured I’d mention it in case you wanted to implement this yourself.