- Home /
Why does this script only play like 0.3% of my animation
Hi Guys I'm using
function Update()
{
if(Input.GetKeyDown("1"))
{
// Plays the animation - stops all other animations
animation.Play("attack 1", PlayMode.StopAll);
}
}
This Script Plays The Animation but it only plays like 2 frames then stops.. is there a way to make a public Variable to adjust how long it will play so i can zone on the correct amount of frames? or is there anyway to force it to play all not just 2 frames.
Only way i can get it to play is to spam "1" but makes it SOOO Choppy and that doesnt really look good.
@AusAndrew19 , when are you going to start accepting answers? Currently only 5 out of 35 questions are accepted. You do realize that you also gain karma by accepting answers?
Um ill accept when the answer is Answerd. This question is still open so why make it accepted if its not correct? I'll accept the answer as correct when i get a right answer.
I wasn't referring to this question, rather all your past questions. Just looking at your last 3 questions, you have not commented, replied, left feedback or asked further questions in comments for clarification. So either you are taking the advice and help, or not. Either way, you have been given answers, and not responded (by comment or acceptance). This is a knowledge-base, meant to help anyone who searches this 'site.
Another point : you seemed happy with my answer to : http://answers.unity3d.com/questions/278058/how-to-add-a-sound-to-this-script.html
quote : Oh mate thank you! i didnt see that all. Sorry :) Thank you heaps. This works completely. thank you buddy :)
yet, my point remains the same ....
This is not a karma grab by me, I have over 2$$anonymous$$ which is all I require. Just letting you know that there is karma there for you, but most importantly trying to help keep the 'site organized.
Answer by Bunny83 · Sep 02, 2012 at 01:47 PM
Well, when you start an animation with Play it will play the animation. The only reasons for this behaviour i can think of would be:
You overwrite the animation somewhere else, maybe in another script.
The bounds of your model is wrong, so Unity thinks it's not visible. Try to set the cullingType to AlwaysAnimate. If it plays you're model has messed up bounds which should be fixed.
Make sure you don't have set your timescale to 0.0.
And make sure the animation plays as expected in the animation viewer. If not, it could well be the animation itself :)
Okay so i changed cullingType to AlwaysAnimate. This suggestion didnt work.. I'm not to sure what timescale is? also no other script uses the animation. Checked animation. Runs perfect in unity3D Animation window.
also my animations are "Split" Because the main mesh had one animation "Take 001" but i followed the guide when i baught the model. and it works in unity3d animation window so i have no idea why this is happening
A good place to start would be to make a new project, but nothing except the model with animations and a script to play them inside and see if everything plays as expected.
If not, it's the animation or a bug. If yes, it's something specific in your project. At least you know with side to look at then.
I created a new project completely and then only added my model. made attack 03 the main one to play when i click play and it works fine.. As i said in my main project i had the same thing happen my AI could attack me completely no probs but when i try it only plays like 2 frames.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to create a gui button inside an if statement? 1 Answer
Player is running just few seconds 0 Answers
need help with a script 1 Answer