When the character dies, an animation plays, and then the scene resets. What I want is that nothing moves/animates except the character and the life bar so I use Time.deltaTime = 0; to do this but it also stops my character and the life bar. Is there a way to force a specific animator to use real delta time?
\$\begingroup\$ \$\endgroup\$
2 - 3\$\begingroup\$ Presumably you looked at AnimatorUpdateMode.UnscaledTime? Did you encounter any difficulty using this to solve your problem? \$\endgroup\$DMGregory– DMGregory ♦2022-02-23 15:44:35 +00:00Commented Feb 23, 2022 at 15:44
- \$\begingroup\$ If that solves your problem, be sure to write up your solution as an answer so it can help the next user searching for a way to do this. \$\endgroup\$DMGregory– DMGregory ♦2022-02-23 16:00:44 +00:00Commented Feb 23, 2022 at 16:00
Add a comment |
1 Answer
\$\begingroup\$ \$\endgroup\$
So for those who have the same question, I've found what needs to be modified: On the animator Component, there is a drop-down menu named "Update Mode" which has three options:
- Normal (in-sync with Update method)
- Animate Physics (in-sync with FixedUpdate method)
- Unscaled Time (in-sync with Update method, but uses unscaled time)
Use the third one if you have the same problem as me. Also here's a picture from unity's documentation about the animator component:
EDIT: I don't know why is this happening but in my case I set Time.timeScale to 0.01f instead of 0 and then everything worked as I excepted
