- Home /
How to make slider function properly after an animation?
So I made a healthbar in unity2d and have a slider to change how much red is shown depending on how much health the player has. It was working fine until I made an animation where the healthbar loads in (goes from 0 to 100 health) and the healthbar now doesn't work properly because the animation is overriding what the healthbar shows. Is there any fix to this?
Answer by Alphacreations · Jun 14, 2020 at 02:41 AM
I fixed it by disabling the animator after the animation finished. It works.
Answer by OwlTeaGames · Jun 14, 2020 at 12:33 AM
Maybe split the process up into two parts- Like the Animation of the health loading is one object, and the health bar is another object. When you start, show the Animated Object, and when it's done animating, Destroy it, and spawn/SetActive/SetVisible the Real Object.
Now, this may seem to be a deceptive practice, but it's not like you're simulating a loading screen that doesn't actually load something. That would be deceptive.
I had a 3D instructor once tell me that we make videogames because we don't want to bear the responsibility of real architecture when it comes to safety and reliability. We don't build the bridge that stays up. We build the bridge the Zygons incinerate in Act One. Therefore, if it Looks Good, it Is Good.
Your answer
Follow this Question
Related Questions
Need help with tool animations!! 1 Answer