Search Unity

PlayableGraph is not cloned when instantiate GameObject

Discussion in 'Timeline' started by dwit_mass_creation, Sep 8, 2017.

  1. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    I have created custom PlayableGraph for Animator. When I clone this GameObject (Instantiate) PlayableGraph for cloned Animator is empty (only one AnimationOutput and not my custom graph).

    So my question is how can I copy entire PlayableGraph hierarchy to another object?

    I have tried some ideas, but many of them are crashing Unity (wrong memory access).
     
  2. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    I don't think you can. There is no copy/clone functionality on Playables or PlayableGraph, and they are not serializable objects (by design).
     
  3. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    Thank you for answer.

    One more question regarding copying PlayableGraph. I create AnimatorControllerPlayable from RuntimeAnimatorController and right now I have to keep reference to that RuntimeAnimatorController in order to copy PlayableGraph. Is there a method to get that RuntimeAnimatorController directly from created AnimatorControllerPlayable or can it be added?
     
  4. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    There is no method exposed for that. I'll send a request to the animation team, it looks like it would be an easy addition.
     
  5. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    Thank you.
    It would be good to have exposed method for getting AnimationClip from AnimationClipPlayable too. I'm sure it will be useful for someone.
     
  6. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Looks like there is - AnimationClipPlayable.GetAnimationClip(). Not sure why it's not documented though.
     
  7. seant_unity

    seant_unity

    Unity Technologies

    Joined:
    Aug 25, 2015
    Posts:
    1,516
    Just checked, and the documentation is in the process of being updated.
     
  8. dwit_mass_creation

    dwit_mass_creation

    Joined:
    Jun 18, 2015
    Posts:
    74
    Oh. Didn't see it. Nice.