Adjust Animation speed directly from Inspector

Hey folks,

I spent the better half of today coming up with a solution to the following problem:
You can’t set animation playback speed directly from the Editor.

You end up having to code the speed change into one of your scripts and that’s not a scalable solution that can be applied to all the other GameObjects in your scene that have Animation components.

You can read the detailed explanation of the solution over at my blog:
Solve the System

Instructions:

Download AnimationSpeedEditor.zip, which contains two script files: AnimationSpeedEditor.cs and OverrideAnimationSpeeds.cs.

Place AnimationSpeedEditor.cs inside a folder named Editor in your project. Create the folder if it doesn’t exist. The other script file can be placed pretty much anywhere.

Find or create a game object that has an Animation component attached, and add the OverrideAnimationSpeeds component to it. You should see the Animation Speeds foldout get added to the view of the Animation component.

Open the foldout. If you have animation clips added to the Animations list of your Animation component, you’ll see sliders for each one. Use these sliders to set a starting speed for your animations. You can also use the sliders during Play mode and see the results immediately.

Thanks.

379297–13121–$animationspeededitor_520.zip (2.74 KB)

1 Like

Cool stuff man. Thanks!

Elegant solution. Cool.

Cool thing, but my scripts are all in JS :frowning:

jrricky, I don’t quite understand what you mean. The two scripts used in this solution only rely on each other. Your JS scripts should work fine alongside them.

Oh, thought it had to rely on my animation js code. Cool, I needed this. :slight_smile:

Wow, this works wonders. Funny thing is, I was just having problems with the animations I have created over the weekend and the speeds I created them at werent syncing with each other and this just make the process very easy. Thanks!!!

You are so very welcome! I’m just glad it’s helpful to some people.

Thanks a lot, its a really simple but incredibly useful tool!

Thank you for making and sharing this! I’m sure this will help many people.

Hey VoxelBoy, one thing I would like to ask is that, if I want to modify the speed by code to, for example, speed up a character, what would you recommend I do while still using this?

Thanks

The OverrideAnimationSpeeds script applies its overrides on Awake. So you can set your own speeds from code while still using this script if you do it anytime after Awake, such as Start or Update.

Hey, I came back to using your script, but I wanted to find out how I would call the script so I can change animations on the fly when I want through that script?

Something like OverriderAnimationSpeeds.Change(animationname,speed);

Ignore me, I got it sorted.

This == BRILLIANCE!

Zionmoose, not to plug my own Asset, but check out ASE too from the Asset Store. It’s the same concept but I have made it more robust. It’s also now on sale for $5.

thanks VoxelBoy this is brilliant!!!

Many thanks! It’s high time I got rid of my thousands of animation.speed lines! Well done Voxel

Thank you for this!

Very nice solution! Thank you for providing this to the community.

-Raiden