Search Unity

Big problem: Playables API generates tons of garbage (Unity 5.5.0f3)

Discussion in 'Animation' started by PhilSA, Dec 2, 2016.

  1. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I was playing around with the Playables API today, and noticed that the AnimationMixerPlayable.SetInputWeight() method generates garbage every time it is called (which is pretty much on every frame, because I use it for all animation blending).



    This basically means the Playables API shouldn't be used by anyone, because having anything that generates garbage every frame should be considered unacceptable. Is there any way around this? Or are there plans to fix this in 5.6? I'm fully aware that this feature is still experimental, but I just want to make sure this gets fixed sooner than later. I can't keep using this until I know for sure that this problem will be gone very soon

    I tested this in a build too, and the problem is still there.

    Would it not be possible to replace the inputs List by an inputs array with a specific size? You'd only have to resize it when inputs are set or added. Actually I'm not even sure why there's a List.Add() operation when setting input weights in the first place (?). Can the "CheckInputBounds()" be avoided completely?

    I've submitted a bug report with an example project ( https://issuetracker.unity3d.com/is...enerates-tons-of-garbage-collector-allocation )

    Thanks
     
    Last edited: Jan 13, 2017
  2. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Bumping this since it hasn't gotten a response. This is a huge issue for me as well, making Playables more or less unusable for what I wanted to do with it. Any plans to fix this Unity?
     
  3. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I got a reply from someone at Unity on December 23. They have acknowledged the problem and said the issue has been forwarded to devs for further review.

    With Timeline (aka Director) being days away from an experimental release (supposedly), I think we might hear about it again soon enough
    https://forum.unity3d.com/threads/timeline-beta-cinemachine.449596/
     
    Last edited: Jan 13, 2017
    TheValar likes this.
  4. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
  5. TheValar

    TheValar

    Joined:
    Nov 12, 2012
    Posts:
    760
    Nice that it will be fixed in 5.6, but I wonder if this fix will come to 5.5. It may be a while before 5.6 is released
     
  6. PhilSA

    PhilSA

    Joined:
    Jul 11, 2013
    Posts:
    1,926
    I don't know for sure, but I really don't think this change will make it in 5.5. The Playables API it totally different in 5.6. Seems like they did a big refactor

    On a side note, we've upgraded a pretty decently-large project from 5.5 to 5.6beta and we haven't had any problems so far
     
    Last edited: Jan 20, 2017
  7. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    The Playables API is indeed undergoing a major refactor in 5.6, so I would strongly advise against building anything that should last with any version before 5.6.

    As it is an Experimental API, there will be no Auto-upgrader, so any changes to fit the new API would have to be done manually.

    We expect the API to stabilize a lot from 5.6 on, because we are basing the Cinematic and Storytelling tools on this.

    As for efficiency; we are using the same APIs as you are to build these tools, so you can expect them to be cleaned up before they move out of Experimental.