Skip to content
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

C# method tweens can't handle 64 bit integer types #81289

Closed
juse4pro opened this issue Sep 3, 2023 · 2 comments · Fixed by #81296
Closed

C# method tweens can't handle 64 bit integer types #81289

juse4pro opened this issue Sep 3, 2023 · 2 comments · Fixed by #81296

Comments

@juse4pro
Copy link

juse4pro commented Sep 3, 2023

Godot version

v4.2.dev3.mono.official [013e8e3]

System information

Windows 11, Godot 4.2-dev3

Issue description

I wanted to create a Tween that interpolates a method in value range of a long type (64 bit). When the tweened method gets called with values outside the "classical" 32 bit number range (-2147483647 till 2147483647) the method gets only a constant value of -2147483647.

Surprisingly the last call of the tween passes in the correct value then.

Steps to reproduce

Use the code snippet on any Node C# script (it was a control node in my case):

public partial class CurrencyView : Control
{
	public override void _Ready()
	{
		this.SetValue(long.MaxValue);
	}
	
	
	public void SetValue(long value)
	{
		Tween tween = this.CreateTween();
		tween.TweenMethod(new Callable(this, MethodName.OnValueTweener), 0L, value, 0.8d);
	}


	private void OnValueTweener(long value)
	{
		GD.Print(value);
	}
}

Then just run any scene with a node in it that has this script attached.
You should see log with the wrong numbers:

-2147483648
-2147483648
-2147483648
-2147483648
-2147483648
-2147483648
9223372036854775807

Minimal reproduction project

tween-bug-project.zip

@AThousandShips
Copy link
Member

This applies to GDScript as well

Will look into a fix, I think I know what the error is

Thank you for reporting, in the future please make sure that a bug is exclusive to C# before reporting for C#

@juse4pro
Copy link
Author

juse4pro commented Sep 4, 2023

please make sure that a bug is exclusive to C# before reporting for C#

True that. Just did not have any experience with GDScript yet but this would probably easily be adaptable. Will take care of that next time. 👍 Thanks for confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants