-
Notifications
You must be signed in to change notification settings - Fork 351
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
Allow tweening for long and ulong data types #6
Comments
Hi, Not a problem at all, should take me just a short time. Gonna implement them in the next days. |
Hey, I implemented it for long, but am having issues with ulong, and I'd need some help. Obviously, I need to multiply a ulong for a float in order to tween it correctly. That is not a problem, and I end up with a float result that is the correct equivalent of the required ulong. The problem is between the conversion from float to ulong. Convert.ToUInt64 (as well as casting to ulong) returns a result, absurdly, whose max allowed value is the max value of a long instead than of a ulong. The only thing that works is converting the resulting float FIRST to a string and THEN to a ulong. But the problem with that is that it generates byte allocations every frame because of the string. Do you have any better idea for the conversion? Am I missing something? |
Thanks for taking a look at this so quickly, I wasn't expecting such a lightning fast response! I could probably buy some time by using the long data type in the meantime while ulong is being implemented. I'll tinker around a bit and see what I can discover about conversions. Maybe a persistent bit array can be used in the conversion process or maybe there's some other kind of built in conversion trick that will suffice. I'll take a look and see what I can come up with. |
Great, that would be very helpful. In the meantime, you can grab the updated version here. Ulong is implemented too, just with those byte allocations that we don't like. |
Well, I checked it out and I found a solution. Cast the float to a decimal and then the decimal can be multiplied by the ulong. So something like this: ulong foo = (ulong)(ulong.MaxValue * (decimal)1f; |
Nice! Gonna try tomorrow morning :) |
Works like a beauty, thanks a lot for the help! New download link coming in next comment |
Implemented in v1.0.416 |
Glad I could help, thanks for the awesome support! |
DOTween makes things incredibly easy and I'd like to see it support more of the primitive data types. My video game project requires unsigned long integers to tween a score display. It would be fantastic if DOTween provided a way to handle this.
The text was updated successfully, but these errors were encountered: