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
- VFX Graph Documentation dropdown button does nothing when clicked on the right side
- Required SpriteMask class (ID 331) is stripped when "Strip Engine Code" is enabled
- “Maximized serialized file backup not found” error is thrown when minimizing a window in a newly opened project
- Build stack trace contains invalid lines when building with IL2CPP using scripts with delegates containing generic types in the signature
- Entities Systems window has a “Show Full Player Loop” dropdown which does nothing when clicked after enabling “Show Full Player Loop”
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;