"The GameObject or Component is missing!" when assigning an animation curve from script.

AnimationClip clips = GetComponent().runtimeAnimatorController.animationClips;
foreach (AnimationClip clip in clips)
if (clip.name == “fade_out_ball”)
AnimationClip fade_out_ball = clip;
AnimationCurve curve = AnimationCurve.Linear(0f, 1f, 1f, 0f);
fade_out_ball.SetCurve(“”, typeof(SpriteRenderer), “color.a”, curve);
GetComponent().enabled = true;
GetComponent().SetBool(“fade_out”, true);

I set up an animation, which is attached to a GameObject. However, when trying to assign a curve form script (key values have to change with every instance of the object), it gives me the above warning and won’t animate anything. Any idea?

Greetings, Footurist

Did you ever solve this? @nilsbargmann
I’m having the exact same issue and it’s super frustrating. Everything about animating in Unity is super tedious and nothing ever seems to work for me.