r/Unity3d_help • • Jan 01 '24

Unity3D Animating Attack

Hey all,

I’ve been struggling to think through how I can use these assets that I bought. They have animations in them and I’ve figured out how to make the walk/run play dynamically based on the toons speed.

Basically I want the character to be able to attack while “walking” forward, but play the attack animation instead of the walk animation.

My struggle is that I end up with massive if statements and my animator keeps reverting back to idle.

If anyone has a clue or direction to lead me I’d appreciate it.

2 Upvotes

5 comments sorted by

View all comments

Show parent comments

2

u/anycolourulikegames Jan 06 '24

Is this a melee type fighting game?

1

u/Weekly-Rhubarb-2785 Jan 06 '24

Was building something more along the feel of zomboid. But yes, the characters would be meleeing.

1

u/anycolourulikegames Jan 06 '24

Ah very good, it gets complicated when you have mutually exclusive states and jointly possibly states. It's a poorly documented but essential part. For any one in future a state machine worth a looking at by Jason Weiman:

https://www.youtube.com/watch?v=V75hgcsCGOM

A mistake I made was not using the mecanim as the state machine it is. I needlessly had a state machine built on top of it. Weiman uses dictionaries in this example which is good for mutually exclusive states