- Home /
Editing Animations crashes Unity
I'm making my first 3rd person adventure rpg and I'm currently working on the animations. When I go into the Animation tab and try to edit the animations, Unity stops responding and freezes. Nothing else in Unity causes it to freeze, so I dont know what the problem is.
Answer by Unity_SA · Feb 10, 2018 at 01:39 AM
I fixed this because I realized that I was playing two animations at once. I had an animation playing, and then when i pressed the mouse I wanted a different one to play. When i pressed the mouse, unity froze.
Basicly what I was doing wrong was that I didnt stop the first Animation from playing. I set the transitions to go off a bool, and so inside each button I used, I needed to set all other bools to false before setting it to false. heres some code:
Animator anim;
int walkHash = Animator.StringToHash("shouldWalk");
int idleHash = Animator.StringToHash("shouldIdle");
int hitHash = Animator.StringToHash("shouldHit");
int jumpHash = Animator.StringToHash("shouldJump");
private void Start()
{
anim = GetComponent<Animator>();
}
private void Update()
{
if (Input.GetKey("w"))
{
anim.SetBool(idleHash, false);
anim.SetBool(jumpHash, false);
anim.SetBool(idleHash, false);
anim.SetBool(walkHash, true);
}
}
then I did this for every button I wanted to trigger an animation. So far I have w,a,s,d,space and mouse 0. hope this helps someone.
Your answer
Follow this Question
Related Questions
How can I find editor log file? 5 Answers
Editor crashes on play 0 Answers
When I place a breakpoint in my code, it crashes Unity Editor 1 Answer
Unity application randomly freezing on occasion 2 Answers
In 5.2.1f1 Editor freezes in play mode 3 Answers