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

Standard Playables asset

Discussion in 'Timeline' started by CraigGraff, Jul 16, 2017.

  1. CraigGraff

    CraigGraff

    Joined:
    May 7, 2013
    Posts:
    44
    Not sure if this is the right place to post this, but here we go.

    The wizard that comes with the Standard Playables asset is pretty cool, but it doesn't let you reference custom types. Is there a reason for this, or was it just an oversight?

    Modifying the Init function in TimelinePlayableWizard.cs like so fixes this (not thoroughly tested, but no problems so far):

    Code (CSharp):
    1.     static void Init()
    2.     {
    3.         var types = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes());
    4.         Type[] componentTypes = types.Where(t => typeof(Component).IsAssignableFrom(t)).ToArray();
    5.  
    6.         // original definition - only allows standard Unity classes
    7.         //Type[] componentTypes =
    8. typeof(Component).Assembly.Where(t => typeof(Component).IsAssignableFrom(t)).ToArray();
    9.         ...
    10.         ...
    11.     }
     
    Last edited: Jul 17, 2017
  2. JamesB

    JamesB

    Unity Technologies

    Joined:
    Feb 21, 2012
    Posts:
    133
    Hello there, the reason for not including custom types was some edge cases cause errors which I didn't have time to work around. I'm hoping that in the future that the wizard will be part of the editor itself and so feature development can continue (I've had to move on to other projects) rather than just bug fixing when they occur.

    For now though, the above code works for a very large percent of cases and I heartily recommend that people who want to use the wizard with custom types implement it. But for now the wizard won't officially support it. Sorry about that.