- Home /
Cannot use an AnimationClip created from script with PlayableAPI
So I'm creating a clip in a script and wanted to play it right through with the Playable API. Unfortunately it doesn't work and I'm getting this error:
Cannot bind generic curve on Transform component, only position, rotation and scale curve are supported
Here's the script: var clip = new AnimationClip(); clip.name = "Test Clip";
var curve = AnimationCurve.Constant(0, 2, 2);
clip.SetCurve("", typeof(Transform), "position.x", curve);
var graph = PlayableGraph.Create();
graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
var playableOutput = AnimationPlayableOutput.Create(graph, "Test Animation", GetComponent<Animator>());
var clipPlayable = AnimationClipPlayable.Create(graph, clip);
playableOutput.SetSourcePlayable(clipPlayable);
graph.Play();
Here are the docs with exact example but instead of getting a clip from outside I'm generating it via script: https://docs.unity3d.com/Manual/Playables-Examples.html
Any ideas?
Your answer
Follow this Question
Related Questions
How to create animations that can be edited with scripts in runtime? 1 Answer
Have some minor problems. Cant tell if its a script issue or a animator issue. 1 Answer
Enable animation C# 0 Answers
Why is my Character staying in Air Idle rather than Grounded Idle? 0 Answers
Can I change animation key frame property in script? 1 Answer