I’m working on a chess game, the base foundation is set up, however I’ve been trying to create animations. I at first set out to use the animation window, but I couldn’t seem to find out how to call upon transform positions set in the code in the animation editor for each keyframe. So I moved away from the in-engine animation to use transform.translate with lerps. I had used lerps before and they work perefectly, as I’d be able to set the variables wherever and whenever I wanted, with an easy means to change. However, I’m trying to design the game to have it so a single button press will cause the object to go through its entire translate lerp until its new position is met.
However, I know that if you call an Input.GetMouseButtonDown(0) in the update function will only cause it to run the lerp in a single frame, causing it to only move slightly forward. This could easily be fixed by changing to Input.GetMouseButton obviously as it would continue to translate no matter what, but by design that’s not what the game should offer. I’ve tried creating loops in and out of the update function to make sure the lerp fully executes, but that would just cause the game object to act like I was calling transform.position, rather than transform.Translate, executing the entire move in a single frame.
I’m asking for help not just as to how I could possibly have a method continue on after a single button press is called, but if it is at all possible to create specific transform positions in C# to then be placed in individual keyframes in the animation window.