Search Issue Tracker
By Design
Votes
0
Found in
2022.3.54f1
6000.0.31f1
6000.1.0a8
6000.2.0a1
Issue ID
UUM-90786
Regression
No
Animation events trigger twice when using blend trees with non-zero weights
Reproduction steps:
1. Open the attached “repro_IN-90638“ project
2. Open the “Assets/Scenes/SampleScene.unity“ Scene
3. Enter the Play Mode
4. Wait until the skeleton moves on top of you
5. Hit the skeleton by pressing the left mouse button
6. Observe the Console
Expected result: Debug.Log messages indicate that the skeleton was hit one time
Actual result: Debug.Log messages indicate that the skeleton was hit two times
Reproducible with: 2022.3.54f1, 6000.0.31f1, 6000.1.0a8
Couldn’t test with: 2021.3.47f1 - Not able to fix non-working Components after downgrading the Cinemachine package
Reproducible on: Windows 10 (22H2), Windows 11 (23H2) (user’s environment)
Not reproducible on: No other environments tested
Note: Reproducible in Player
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Builder can't set a background image to a sprite from a multi-sprite spritesheet in the Resources folder
- Light2D freeform does not render the internal part when rendered in certain shapes
- Using AddCopyPass causes an incorrect merging of passes.
- Negative Enum value is not pasted correctly when copying from another array
- Silent Crash when generating Lightmap UVs for a model with a large object scale
Resolution Note:
This is as intended. (see https://discussions.unity.com/t/mecanim-5-blend-tree-animation-event-called-twice/576456/8). Blend trees mean that several clips are run at the same time, and we do want events from all of them, even if they do not make sense in some cases (like yours for the sprite base animation), but it makes sense for many others situation.
One proposed workaround that I tested on the provided project is therefor to pass the animationEvents in the function
public void DealDamage(AnimationEvent evt)
and in the event, pass the old int parameter in the int field. then, you can add code to verify, is the weight of the current animation <0.5?
if (evt.animatorClipInfo.weight < 0.5)
return;