Animations and how to determine the lenght?

I am working with C# So to give you the context, I am having this character, that has a hit animation, I have set it so that while the hit animation is playing, a boolean makes sure that the character can deal damage. However, I have now come to the conclution, that I do not want the character to be able to deal damage during the entire animation, but only in a part of it. I am currently trying to solve it with a corutine waitforseconds, but first of all, it is pretty hard to make sure that it waits for the correct amount of time before enabling the damage boolean, second it really dosent feel right, and is kinda clumsy. Does anyone have a suggestion on how to solve this problem?


I think what we do on the game I'm currently working on is that we set up an 'attack' script which has all of the information on a particular attack -- damage, animation speed, range, and damage point, then we manually yield for seconds on the damage point. It takes some tweaking to get it right, but you only need to get it right once more or less.

Alternatively, you could use physics to detect collisions and deal the damage at that point.