0 votes
asked in General Help by
Hi, am new to animation as a whole, but i was wondering if i can create 2 reload animations clips at same time.
More like i have an FPS hand and a Gun. And i want to animate both the hand and the gun then export the one for hand to a hand animator controller and the other to Gun animator controller (cant find a way to do this and i cant edit then independently since one will end up falling of sync).

Also i cant use the parenting since each gun has different animation  for each character and are instantiated on runtime. (IDK if i can)*

1 Answer

0 votes
answered by Expert (80k points)
Best answer

Hi crhys,
thank you very much for your support request.

So if I understand you correctly, you have multiple different arm/hand models and multiple different weapons, correct?

There are various ways how you can do this. A few things to consider:

  1. Using one Animator to control the hands and the gun will make everything much easier.
  2. Parent the gun to the right hand bone (either in Unity's Hierarchy window) or during run-time via script (see Transform.SetParent()). This will make the gun automatically move with the right hand. 

One possibility would thus be that you create one prefab per arm/hand with all weapons attached. Then use that model within UMotion and create all the animations for every gun. Animate the "Renderer.enable" property of the guns (using a Custom Property Constraint, see UMotion manual) to switch the visibility of the guns on/off.

Advantage: Nearly no scripting required (the Animator State Machine will do everything for you).

For each arm/hand + weapon combination I would create a seperate UMotion project. Set the visibility of the transforms of the weapons that you are not animating to locked. This ensures that the resulting *.anim file has no animation data about the other weapons in it. This can only be done on a per UMotion project basis (not per animation) as the settings done in Config Mode apply to all animations in that UMotion project.

Or you create a single prefab for each arm/hand + weapon combination and animate that. Then while playing the game, exchange the arm/hand + weapon combination when switching between weapons.

Please let me know if you have any further questions.

Best regards,

commented by
I cant animate the both then add each to its controller? because a trying to avoid having all my guns in one prefab then toggling between them or having each arm for every single gun.
commented by Expert (80k points)

In Unity's *.anim file, animated properties are addressed using so called transform paths. If your weapon is a child of the right hand while animating, a transform path like "FPSArmsPrefab/UpperArm/LowerArm/Wrist/Weapon1" will be stored into the *.anim file for addressing the weapons properties. The transform paths always need to be relative to the Animator controller that plays the *.anim clip.

So theoretically you can temporary animate the hands and weapon together, and split the *.anim files manually (duplicate the *.anim files and remove the not needed properties in Unity's Animation Window).

But you somehow need to make sure that the transform paths are correct. You could manually correct them by opening the *.anim file in a text editor (the editor needs to have "Asset Serialization" set to "Foce Text"). Or you write some scripts to do that (the API for that is documented in the Unity Manual).

Or you keep the animations together in one *.anim file. Play that on the arms/hands animator controller. Don't create a prefab for the arms/hands but rather attach the weapon to the hand bone (using Transform.SetParent()) during runtime.

Another possibility after thinking a little bit about this could also look like this:

  1. Drag&Drop the arms/hands in the scene
  2. Make the gun a child of the arms/hands topmost GameObject
  3. Use the Child-Of constraint to parent the gun to the hand
  4. Animate everything then export the *.anim
  5. Duplicate the resulting *.anim
  6. Open the *.anim files in Unity's Animation Window: Remove the animated properties of the arms in the one file and the properties of the gun in the other.
  7. Now remove everything related to the arms/hands of your temporary GameObject but keep that topmost transform. Save that as new prefab for your weapon. The Animator needs to be attached to that topmost transform as now the transform paths stay exactly the same.
  8. During runtime, instantiate the weapon and always make sure that both topmost transforms have same position/rotation/scale. Make sure to play both animations on both Animators exactly at the same time (this might also get tricky).
Btw. there is also a Sync button in the Clip Editor. It allows you to synchronize UMotion's Clip Editor with Unity Timeline or the Animation Window. That way you can play an animation for the hands using e.g. the Animation Window and play the animation of the weapon using UMotion.
Please note that you can only edit one animation (the one opened in UMotion) at a time.
I hope this gives you a better idea of what is possible. Let me know if you have any further questions.
Best regards,

Soxware Support

Here you get official product support by the developer and the community for all Soxware Products for Unity®.

Post as guest, login via Facebook or create an account.

Ask questions, report bugs or provide feedback. Please use the correct category and always post in english.

For private email support, please use the Support Form to create a support ticket.

Copyright © 2017 Soxware Interactive | All Rights Reserved | Impressum