Hello, I am trying to extend AnimationPlayableAsset in order to add a few features that are specific to my game into it (for example, I'd like to be able to add control on blendshapes on some animations, or other things like that). Most importantly, I'd like to be able to keep the ability to preview the animation on my character when using preview mode. For the moment, I am struggling with trying to inherit from AnimationPlayableAsset, but I am not even sure that is the right approach. Has anyone managed to do something like this already? Thanks in advance.
I would like this too. Unforunately the timeline feature isnt all it was cracked up to be, and because of the lackluster reception I have very little faith it will ever get "finished". Just look at the terrain system , or nested prefabs. Some things never get done, I worry this will become another semi integrated semi finished system that gets put to one side.
AnimationPlayableAsset wasn't originally intended to be extended, although that seems like a something that has been requested by several people. There are plans to give users more control over animation in general, and that will extend to timeline. The ground work for that is just starting now. As for worries that timeline will never be "finished", it has a dedicated team at Unity. It is actively being worked on and we are always looking for feedback to make it better.
Bump. Any news on this functionality? I would like to extend the Animation Playable to add my own callbacks when Animations are played, blended or otherwise interacted with from the Timeline.
The ability to extend AnimationPlayableAsset hasn't explicitly been worked on, but there are several things that have landed since the last post, or will land soon that will help. Animation Events are now supported in timeline. Animation C# Jobs were recently introduced. We are currently looking at integrating those into timeline. Not quite the callback mechanism, but it would be a way to inject into existing animation tracks. You can create your own simple animation tracks. It can be useful where root motion and offsets that typically are needed with character animation aren't needed (UI for example). There you would have fully control over the resulting graph produced. Playable Notifications in 2018.3 let you send notifications to a binding. This is a precursor to timeline events. I quickly tried extending AnimationTrack and AnimationPlayableAsset and injecting a simple script playable into the graph to get a clearer picture of what worked and what didn't, and on the surface it's possible to get something working. But the extended classes don't properly inherit a lot of the customization done for Animation Tracks, so they are more difficult to use (for example, the matching options aren't available and the inspector is not inherited). I'll post it here if you want to look at the methodology. I built it with 2018.3 (which has improved Animation Tracks).
After fiddling around with your examples I managed to make it work! Thanks a lot. I did it with 2017.4.10f1 Now I have one further question: Right now I have to create an asset of CustomAnimationPlayableAsset type and then drag it/select it from the context menu). It would be nice to just either drag an animation and have it create a CustomAnimationClip instead of the default AnimationClip or alternatively be able to simply add a Clip and then assign the animation in its inspector (basically bypassing the whole creating an asset step). But since I haven't found a straightforward way to do this I assume it's due to some behind-the-scenes editor magic regarding the AnimationTrack. Any advice on this? Maybe this is possible in 2018.3 but we're unfortunately stuck with 2017.4 for now
Sorry, no way around that one 2018.2 has better drag and drop support and recognizes ExtendedAnimationPlayableAsset, but it prioritizes AnimationPlayableAsset over ExtendedAnimationPlayableAsset.
thank's so have extention of AudioPlayableAsset but hope for better workflow and understand think's i do lol so need 2 think's is autosetup clip lenght and get clip name like base AudioPlayableAsset do by default or another way maybi
I'm looking for a way to define (or change) the clip of an AnimationPlaybackAsset through script in runtime. Is that feasible?
Yes, it is. Here's an example that replaces them all. Code (CSharp): var timeline = (TimelineAsset) playableDirector.playableAsset; foreach (var track in timeline.GetOutputTracks().OfType<AnimationTrack>() { foreach (var clip in track.GetClips()) { var animPlayableAsset = (AnimationPlayableAsset) clip.asset; animPlayableAsset.clip = myAnimationClip; } } playableDirector.RebuildGraph(); Note that you are modifying the asset in this case, which even in playmode may get saved.
sorry to necropost this but has there been any progress with extending the animation playable for the timeline?