Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  6. Unity 2017.2 beta is now available for download.
    Dismiss Notice

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:
    31
    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:
    143
    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:
    31
    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:
    143
    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:
    31
    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:
    143
    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:
    143
    Just checked, and the documentation is in the process of being updated.
     
  8. dwit_mass_creation

    dwit_mass_creation

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