I’m working in unity on a procedurally generated weapons system (so you can generate infinite combos of crosses, scopes … etc), and now i would like to add animations to them.
For example, i would like all of them no matter what they look like to play a swing animation when the player is running, or to play a recoil animations when player shoots … etc
The problem is that after some researchs and experiments, i can’t find how to make this working.
All of my generated weapons have the same structure :
- A parent Weapon object with my Weapon Script attached (fully instantiated from scratch, it aint a prefab)
- under the Weapon parent, all the gameobjects for the parts of the weapon (cross gameObject, scope gameobject, loader gameobject … etc)
- under some of the parts, (cross and main body) are empty gameobjects for player hands targets, as the holding of the weapons are driven by inverse kinematics.
How can i attach an animator or animations to my weapon when its generated so that it animates the hand targets (or the whole weapon as it will move the hand targets) ?
Thanks
Is it possible to create an animation on a blank gameobject in editor and then on weapon spawn assign it to the weapon? Animations are proper to the gameobject animated so i dont know how to make it working.