-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return a sensible value for animation component duration if no animation is playing #4765
Conversation
I'd like returning 0 more I think, and using Debug.warn to let the user know. |
Yeah, I'm very torn on getting infinity errors 'silently' and not seeing it until it hits something that fires an exception (usually far away in the call stack from the actual cause) and actually giving a number that makes sense common use cases. If you still think it should be 0, I will change it but have the above concern. |
I understand, but a warning should solve the problem really. |
Updated PR to use 0 with warning |
Co-authored-by: Martin Valigursky <59932779+mvaligursky@users.noreply.github.com>
Stops exception being thrown when using duration if there is no animation playing
Returns
Number.MAX_VALUE
instead of 0 as some developers may be dividing by this number for a normalised value and this avoids divide by 0.A bit torn on whether this is the 'right' number to return though?
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.