Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by ArkarKyaw · Mar 06, 2014 at 08:53 AM · animationmecanim

How to change animation speed in blend tree by script?

I want to set "This" value in the screenshot by script.Is there any way?Pleasealt text

toask.png (26.2 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Subhajit-Nath · Mar 06, 2014 at 11:19 AM 0
Share

Was asked there as well.

http://answers.unity3d.com/questions/612520/how-to-access-blend-tree-speed-in-mecanim-from-c.html

2 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by augivision · Apr 02, 2018 at 09:18 AM

This answer may be a little late, but I wanted to achieve the same thing and this is how I accomplished it.

alt text

In my Blend Tree, I added the same animation with a lower Animation Speed.
Notice how I have the Walk motion twice. One with the speed set to 1 and another with the speed set to 0.5


This allows me to slow the walking animation if the player is pressing lightly on the joystick and speeds the animation up if the player presses the joystick harder.


I added a float parameter called speedPercent. In my code, I change the speedPercent by using:

 public Animator animator;
 
 
 if(walkingSlow)
 {
 animator.SetFloat("speedPercent", 0.3f)
 }
 
 if(walkingFast)
 {
 animator.SetFloat("speedPercent", 0.6f);
 }
 
 if(running)
 {
 animator.SetFloat("speedPercent", 1f);
 }
 
 else{ animator.SetFloat("speedPercent", 0f); }


This code is just an example, it is not the actual code.


manageanimationspeed.png (198.4 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by duartejuca · Mar 14 at 05:01 AM

The animator speed property do this, but the animator speed work with all animations,so you have to change the speed for all animations in animator controlling them, for example, if your player movement, need to change the animation speed to run clip and want the animation more faster, you must change the animator.speed to 2. After this when you need to back speed, change the speed back to 1 in idle animation or other animation.

 private Animator animator;
 animator.speed = value;
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

23 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Animation Events and Mecanim 0 Answers

What is the proper way to wait for an Animator Controller to update? 1 Answer

Mecanim Animations float til end of animation 1 Answer

Animation Gets Clipped When Speed Is Changed (Mecanim) 1 Answer

How can I change a mecanim animation by pressing a key? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges