Projectile attached to animator

I dont think that the animator is the best place to attach the projectile to.

I was thinking on creating a weapon class and attaching the projectile to that instead of the animator.

The weapon and projectiles can still listen to event and instantiate just like we did in the course but at least I feel like it would be grouped with the right components.

What do you guys think?

1 Like

It’s entirely a matter of preference here. What’s important, with this UnitAnimator setup that the UnitAnimator somehow gets the projectile’s reference.

My personal preference for this is to use a form of dependency injection. In this case, the ShootAction has the projectile, and the projectile is added to the OnShootEventArgs. Then the Animator can instantiate the projectile from the args.


Privacy & Terms