Aniamtion overwrite variables

Hi guys, I have a question about animations. I have Player and player has a Point light, a in this point light I change variables in animation (once, only in this start animation): 8409900--1111236--upload_2022-9-2_11-3-35.png
And after this animation I want to change variables from Point Light in script:


And the problem is the animations overwrite variables in light and size of inner and outer radius dosen’t change. After the start animation I don’t use varaibles from this light in any other animations. I tried wait for end “start aniamtion” like:
but it dosen’t work.
Is there any posibility to manage this variables in light and change them via script after this animation?

I will be greteful for any replies.

There’s probably a way, but you should just control the light entirely from script, it’ll save you a lot of trouble. If you add a property to an animation even a single time, the animator will take control of that property permanently; this is necessary so that your properties can revert to default settings when a new animation is played (at least this is my understanding of it).

If you need the animation to time changes to the light, you can use events: Unity - Manual: Use Animation Events

1 Like

I found the thread: [Animator locking animated value even when current state has no curves/keys for that value | Page 3 - Unity Forum]( https://discussions.unity.com/t/645479 page-3)

Also I made it as you said, I create a function which control variables from lights on start, because size of variables in light are connect with player position on Y axis. So I can crate a math propotion for it and I think it’s better because I manage light only in script.

But if somebody knows how fix bug with lock variables by animations and want to share with solution will be great :slight_smile:

1 Like

There might be a way around it, but it’s not a bug.

1 Like