Skip to main content
Bumped by Community user
Bumped by Community user
add transition backout from playershoot to playeridle
Source Link
otong
  • 125
  • 10

From the unity documentation: https://docs.unity3d.com/Manual/AnimationParameters.html

Trigger parameter: a boolean parameter that is reset by the controller when consumed by a transition (represented by a circle button)

So it should play the animantion once right?

In my current game I already set my animation transition condition to trigger, then in gameObject script I also set the parameter, but it plays more than once.

Here are my animation parameter

Here are my animation parameter

Here are my animation transition condition

enter image description here

And here are my gameObject script to set the parameter

Animator anim;
Start() {
        anim = GetComponent<Animator>();
    }

void shoot() {
        anim.SetTrigger("shoot");
    }

EDIT: this is the transition out of PlayerShoot, returning to PlayerIdle enter image description here

From the unity documentation: https://docs.unity3d.com/Manual/AnimationParameters.html

Trigger parameter: a boolean parameter that is reset by the controller when consumed by a transition (represented by a circle button)

So it should play the animantion once right?

In my current game I already set my animation transition condition to trigger, then in gameObject script I also set the parameter, but it plays more than once.

Here are my animation parameter

Here are my animation parameter

Here are my animation transition condition

enter image description here

And here are my gameObject script to set the parameter

Animator anim;
Start() {
        anim = GetComponent<Animator>();
    }

void shoot() {
        anim.SetTrigger("shoot");
    }

From the unity documentation: https://docs.unity3d.com/Manual/AnimationParameters.html

Trigger parameter: a boolean parameter that is reset by the controller when consumed by a transition (represented by a circle button)

So it should play the animantion once right?

In my current game I already set my animation transition condition to trigger, then in gameObject script I also set the parameter, but it plays more than once.

Here are my animation parameter

Here are my animation parameter

Here are my animation transition condition

enter image description here

And here are my gameObject script to set the parameter

Animator anim;
Start() {
        anim = GetComponent<Animator>();
    }

void shoot() {
        anim.SetTrigger("shoot");
    }

EDIT: this is the transition out of PlayerShoot, returning to PlayerIdle enter image description here

Source Link
otong
  • 125
  • 10

Unity Animation isn't played once despite using trigger parameter

From the unity documentation: https://docs.unity3d.com/Manual/AnimationParameters.html

Trigger parameter: a boolean parameter that is reset by the controller when consumed by a transition (represented by a circle button)

So it should play the animantion once right?

In my current game I already set my animation transition condition to trigger, then in gameObject script I also set the parameter, but it plays more than once.

Here are my animation parameter

Here are my animation parameter

Here are my animation transition condition

enter image description here

And here are my gameObject script to set the parameter

Animator anim;
Start() {
        anim = GetComponent<Animator>();
    }

void shoot() {
        anim.SetTrigger("shoot");
    }