- Home /
Parameterized Animation Clip
Hello! I'm pretty new to Unity and I have a simple design problem.
I'm creating a chess game and I wanted to make a fancy animation of a piece jumping to any field. There are 64 possible fields and the player chooses the destination field.
I created a simple animation clip of a piece jumping 2 fields forward. Unfortunately I discovered that if I wanted to make a universal animation clip of jumping to any field I would need to pass the coordinates of the destination to animation clip at runtime but I don't know how to do this.
I've set up animation controller and it works fine. Animations Controller have parameters but from what I understand they only determine the state.
I tried using AnimationClip.SetCurve() but it only works in editor.: https://docs.unity3d.com/ScriptReference/AnimationClip.SetCurve.html Since there are 64 possible fields, I would need to generate 64 different animations and it just seems wrong. It would be much easier if I could just set it up on runtime.
Is there any way to make it work or I just need to give up on animations?