Search Unity

Remove game object while animation is playing breaks animation

Discussion in 'Animation' started by ZenTeapot, Apr 26, 2018.

  1. ZenTeapot

    ZenTeapot

    Joined:
    Oct 19, 2014
    Posts:
    65
    I'm running the Unity native animation system and noticed the following issue. Given an animation tree like this:

    body // character body sprite
    - hand1 // a sword game object
    - hand2 // a shield game object

    I animated hand1 and hand2 directly on body. And when the game is running, I dynamically destroy hand1 and hand2, and recreate hand1 and hand2 from different game objects(for example two short swords), and the animation goes totally nuts. Is this an intended behavior? Or is there any way to make this work? Thanks!
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    The process (deleting bones then recreating them and adding them back into the rig) - is not expected behavior, so the results experienced isn't really expected behavior either.

    Can the hands stay in the rig and only instantiate the weapons instead?