Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feedback PlayableGraphs are all destroyed for no reason when saving the scene

Discussion in 'Animation' started by Kybernetik, Jan 15, 2020.

  1. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,555
    Bug Report Case 1210824 - the response was basically "it's by design, we aren't going to fix it, you can make a feature request at http://feedback.unity3d.com/" (which is of course a link to the old feedback site that doesn't exist any more and just redirects to these forums).

    PlayableGraphs are really handy for playing animations in Edit Mode, particularly using OnValidate which is called when assemblies are reloaded or when anything is changed in the Inspector. Except that saving the scene causes Unity to destroy my PlayableGraph and does not call OnValidate again afterwards. Unity support claimed that this is "by design" because PlayableGraphs can't be serialized, but:
    • Serialized fields don't lose their values when saving the scene.
    • Non-serialized fields don't lose their values when saving the scene either.
    • You need to explicitly make sure that you destroy any PlayableGraphs you created when exiting Play Mode or when scripts are recompiled to prevent Unity from giving you a warning.
    • Yet Unity thinks it's fine to just destroy them when the scene is saved.
    So in most circumstances Unity blames me for not destroying them and won't do it automatically, but then it goes ahead and destroys them for no reason when saving the scene.

    And it is of course extremely unlikely that this "by design" behaviour is actually documented anywhere.
     
    spacefrog likes this.
  2. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    734
    Thanks Kybernetik for constantly pushing it on the unity animation front. I use Animancer and make heavy use of it's editor playing capability. And of course I do get those annoying destroyed PlayableGraph error messages a lot in the console ...
    Just posted to give some moral support :)
     
    Kybernetik likes this.
  3. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,555
    Thanks for the support.

    When using Animancer or when managing your own? Because if it's when using Animancer I might be able to fix it (and I've already improved that area a bit in the current v4.0 Beta.
     
  4. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    734
    When using animancer , havent looked into the playables api myself at all , as animancer is perfect for everything i need ( sprite anim control )
    Looking forward for Animancer V4.0 ... though the current version does work really well for me already
     
  5. Kybernetik

    Kybernetik

    Joined:
    Jan 3, 2013
    Posts:
    2,555
    Is there anything in particular you are doing when it causes the warnings? Is it in Play Mode or Edit Mode?
     
  6. spacefrog

    spacefrog

    Joined:
    Jun 14, 2009
    Posts:
    734
    the errors appear in edit mode when i playback animation clips from within a custom inspector for my animations ( using animancer ) -
    but i just rechecked: its really no problem as it is indeed not happening very often and as i said only while in edit mode or when i enter playmode ( i guess when there is still some in-editmode-playing going on on some gameobject at that time )
    not a big deal really ...