Lack of frame by frame control?

I am testing stuff out to try and get a basic 2D fighting game working( 3D models fighting in a 2D arena )

From what I’ve gathered, unity does not allow for frame by frame control from scripts. Things like animations are based around time instead, which makes my goal of having precise frame by frame 2D hitboxes impossible.

I thought I could use colliders, and even coded up some scripts that would get the exact 2D profile of a box collider, but I don’t know how I could place them during attack animations without frame by frame control in scripts.

Is this actually a major problem or have I just missed unity features?

I agree.

It’s not like scripting 101 in unity involves using the Update function that Unity calls every frame.

This is exactly what the update function and Time.deltaTime are for.

I know I can use the update function to run code every frame, but as far as I can tell I cannot get which frame of animation a character is in for drawing hitboxes properly. Am I missing something?

Why would you want to calc those manually? Would you just not attach the hitboxes to the bones, and then draw them wherever they happen to be? Maybe I’m misunderstanding your application, but this is what I would do in 3D.

One major problem is that some colliders would only want to become active on a certain frame.

For example, if there was a punch with a long windup animation, I wouldn’t want a collider on the characters fist become an active attack hitbox until a very specific frame of animation.

Which just led me to the thought of splitting the animations up as needed, which leads to another question: Is it possible to tell exactly when animations start/end so that I could tell when to draw new hitboxes? For example, flow from windup animation to attack animation to recovery animation?

If it’s a standard animation, then you can create events at specific points in the animation:

http://docs.unity3d.com/Documentation/Components/animeditor-AnimationEvents.html

If you’re using Mecanim, I’m not sure that is in there yet - if not, there is a plugin you can purchase on the store for that. (or you can use extra curves, but it’s more work).

Are you making a fighting game?

You would need to use animation events to call script at points on the animation, like when the foot hits the ground. If you’re using mecanim, there is a package that makes it work. https://www.assetstore.unity3d.com/#/content/5969