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

TextureProgress node does not display progress when value is set in code (HTML + C# Export only) #47898

Closed
thes3m opened this issue Apr 14, 2021 · 10 comments

Comments

@thes3m
Copy link

thes3m commented Apr 14, 2021

Godot version:
3.3 RC8. RC9 x64 Mono (this issue did not occur in previous versions)

** Platform **
Windows (HTML5 Export)

Issue description:
TextureProgress node does not display correct progress when progress value is set in code. The progress bar is displayed when game starts, however as soon as TextureProgress.Value property is set the progress bar will disapear. This only occurs in HTML5 export (can be runned from editor).

Steps to reproduce:

  1. Open the provided project
  2. Go to Project->Export and add HTML5 export
  3. Build and start a desktop project from editor
  4. You should see the progress bar filling itself constantly
  5. Press HTML5 button in top right corner of editor to run the project in the browser
  6. You will see that the progress bar is not displayed on HTML5

** Expected result **
TextureProgress should display progress on HTML5

GodotProgressBarTest.zip

@thes3m thes3m changed the title [3.3 RC8, RC9] TextureProgress Node does not display progress when Value is set (HTML Export only) [3.3 RC8, RC9] TextureProgress Node does not display progress when Value is set in code (HTML Export only) Apr 14, 2021
@thes3m thes3m changed the title [3.3 RC8, RC9] TextureProgress Node does not display progress when Value is set in code (HTML Export only) [3.3 RC8, RC9] TextureProgress node does not display progress when value is set in code (HTML Export only) Apr 14, 2021
@Calinou
Copy link
Member

Calinou commented Apr 14, 2021

@thes3m Can you reproduce this in a GDScript project?

@thes3m
Copy link
Author

thes3m commented Apr 14, 2021

@Calinou No, apparently it only occurs in C#.

@akien-mga
Copy link
Member

I can confirm the bug with the provided project, and indeed, surprisingly it only happens with C#.

Equivalent code for GDScript:

extends Control

var progress : TextureProgress

func _ready():
	progress = $TextureProgress

func _process(delta):
	progress.value += delta
	if (progress.value >= 1):
		progress.value = 0

@akien-mga
Copy link
Member

Apparently delta is 0 in this script when using C# in the HTML export.

using Godot;
using System;

public class Progress : Control
{
	private TextureProgress progress;

	public override void _Ready()
	{
		progress = GetNodeOrNull<TextureProgress>("TextureProgress");
	}

	public override void _Process(float delta)
	{
		GD.Print(delta); // 0 on web, 0.01667 on desktop
		progress.Value += delta;
		if(progress.Value >= 1){
			progress.Value = 0;
		}        
	}
}

CC @neikeq @Faless

@thes3m
Copy link
Author

thes3m commented Apr 15, 2021

@akien-mga Didn't even notice that delta is 0. Seems like there is a bigger issue, probably something is wrong with float types, seems like they are "rounded" to 0 or something. Setting progress.Value += 0.016f still does not work.

@akien-mga
Copy link
Member

akien-mga commented Apr 15, 2021

I've tried to narrow the regression down, so far I have:

  • 3.2.4 beta 4: OK
  • 3.2.4 beta 5: broken
  • 3.2.4 RC 1: broken

I'll test other intermediate betas and update.

Didn't even notice that delta is 0. Seems like there is a bigger issue, probably something is wrong with float types, seems like they are "rounded" to 0 or something. Setting progress.Value += 0.016f still does not work.

Yeah actually after testing again I can't reproduce delta being 0 either, but assigning to Value doesn't seem to work (neither with += or =).

@akien-mga
Copy link
Member

akien-mga commented Apr 15, 2021

I haven't tried to bisect yet between 3.2.4 beta 4 and beta 5, will do in a bit.

But some potential candidates:

@akien-mga akien-mga changed the title [3.3 RC8, RC9] TextureProgress node does not display progress when value is set in code (HTML Export only) TextureProgress node does not display progress when value is set in code (HTML + C# Export only) Apr 15, 2021
@akien-mga
Copy link
Member

I can confirm that it's a regression from #44373, CC @neikeq.

I did two tests builds with the current build containers (same as for 3.3 RC 9) using Mono 6.12.0.122, and where the patch for WASM m2n trampolines should be properly applied:
https://downloads.tuxfamily.org/godotengine/testing/issue47898/

That's builds of 80c9f2d (merge of #44373) and 9710a38 (parent commit).
For both builds I had to also cherry-pick bf94244 to fix exporting HTML5 projects with the BCL.

80c9f2d is bad and 9710a38 is good.

@neikeq
Copy link
Contributor

neikeq commented Apr 17, 2021

Thanks for the bisect and for determining the cause of the bug! Saved me a lot of time.

@akien-mga
Copy link
Member

Fixed by #47968.

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

No branches or pull requests

4 participants