Dynamically speed up animation

I have an ability that increases reload speed, and I would like to increase the reload animation so I'm still using animation events, rather than a set duration. I looked into the GenericReloader module for shootable weapons, but was unable to determine where I could increase the animation speed. I see options to ignore animation events and just have a set duration, but since running/ walking is dynamic to speed, theoretically other animations should be as well.

I asked on discord and it was suggested that I look into the timescale property of the animation.
image.png


Image Credit Davion13 on Discord.

What do you think is the best way to access this property? Ideally I could somehow use the GenericReloader module to access the property and adjust the speed of the animation, but I'm not quite sure on how the module communicates with mechanim (I followed the code down many rabbit holes, but I'm just not seeing/ understanding enough of the big picture to manipulate it yet).

Edit: Ideally the solution to this would be able to be refactored for other use cases as well: Aim-Down-Sights speed, weapon swap, mount-unmount, ect.
 
Last edited:
This is an interesting one. Modifying that circled timescale field is a good way to do it, but I haven't actually accessed that property at runtime before. For this situation it will take a new module, and from that module you could set the blend tree timer value.

The Generic Reloader doesn't explicitly interact with the animator - instead it returns the item state index which is then used by the Animator Monitor. For your situation you'll need an explicit reference to the Animator within a new module.
 
That makes sense. However, seem to have run into a somewhat silly blocker... I cannot seem to get blendtree data without using the AnimatorController class...which is in the UnityEditor namespace.
I tried using RuntimeAnimatorController, but it has rather limited functionality, and and animation clips I get from it seem to be Read-Only.
Are you aware of any way to get AnimatorController motion/ layer data without using the UnityEditor namespace?

This might be a question better suited for Unity Forums, but I figure you may have run into and solved a similar issue before.
 
I only know of how to do it in the editor as well. Just a quick search didn't really lead any promising results either. I do think the Unity forum is your best bet.
 
I found a solution. By using the multiplier parameter on the reload motion, I am able to change the speed by animator.SetFloat() like normal. I should note that I had to add the reloadSpeedMult as the multiplier parameter for each weapon in the Arms layer and the Upperbody layer. It's a very small amount of work for a nice feature, maybe reload and ADS speed could make it into the Demo Animator controller? The ADS speed could make aiming on certain guns feel weightier or snappier.

1677886172924.png
 
Top