Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 You! · Jun 18, 2012 at 08:38 PM · animationparentblendthrow

animation.Blend() not playing

I have to have an animation in a parent object play in order for some events to work (because it has an animation event). The rest of the script which would activate the animation works (I checked using debug logs), but the animation itself won't play. I need the animation to be able to be played while the character is moving (this is why I thought I'd use animation.Blend()) Here's the code for the animation so far:

 var MainM : GameObject;
 var caseSwitch : boolean = true;
 
 function Start(){
 MainM = transform.parent.transform.parent.transform.parent.transform.parent.transform.parent.transform.parent.transform.parent.transform.parent.transform.parent.transform.parent.gameObject;
 
 //MainM is a very distant ancestor!
 MainM.animation["Throw"].wrapMode = WrapMode.Once;
 }
 
 function Update(){
 //[...]
 if(Input.OnMouseButtonDown(0) && caseSwitch){
 MainM.animation.Blend("Throw");
 caseSwitch = false;
 }
 }

I've also tried to use animation.Play() and animation.CrossFade() instead of animation.Blend(), which yielded the same, nonexistent results. Also, I've tried to, instead of using transform.parent, assign the game object in the inspector. No change in results.

==========================================================================================

Edit: animation.Blend(), animation.CrossFade(), and animation.Play() have all failed. The source of the problem is most likely something with the animation itself. I have tried re-making the animation with no success. Any suggestions to help with re-animation and fixing the problem this way is appreciated. Thank you.

==========================================================================================

Comment
Add comment · Show 41
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 whydoidoit · Jun 18, 2012 at 08:45 PM 0
Share

You aren't actually doing it every frame?

avatar image You! · Jun 18, 2012 at 08:50 PM 0
Share

Nope... There's some if statements which control whether or not the animation plays. These if statements also affect other variables (like the number of objects that the player has available to throw). The rest of the stuff is activating (once, not continually), but the animation isn't playing at all. I'll add a bit to the shown code to symbolize this.

avatar image whydoidoit · Jun 18, 2012 at 08:51 PM 0
Share

Yeah what I mean is that Blend may restart the animation every time you call it so it should be triggered and not called continually when in that state.

avatar image whydoidoit · Jun 18, 2012 at 11:34 PM 1
Share

Oh really ugh. Really sorry, I'm going to have to leave you too it for a bit. I'll think on...

avatar image whydoidoit · Jun 20, 2012 at 05:11 PM 1
Share

This has got to be something to do with the animation oh hell. $$anonymous$$gest you edit your question and put the fact that our investigation has pretty much failed in there in bold :) I can't think what else to suggest...

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by dylanfries · Jun 29, 2012 at 12:42 PM

Make sure the animation you are calling has a higher blend weight then the animation already playing. If it is lower, the animation will be considered playing but will not have any influence on your model. Also make sure the animation weight is set to 1.0 ( or less if your want to only partially apply it.

Comment
Add comment · Show 1 · 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 whydoidoit · Jun 29, 2012 at 12:45 PM 0
Share

Actually the blend weights are normalized and allocated proportionately. A lower blend weight does not mean the animation won't play, it just means it would have a lower effect. Having layers does cause this problem as higher level weights are allocated first.

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

6 People are following this question.

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

Related Questions

Animation precision? 0 Answers

Can I make animations snap to a frame? 1 Answer

Accessing a child's animation to play or stop it 2 Answers

Animation of throw spear 1 Answer

Animation does not play in relative position, even with parenting 5 Answers


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