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

UI Controls don't receive Update event #2627

Closed
mtszkarbowiak opened this issue May 20, 2024 · 4 comments · Fixed by #2637
Closed

UI Controls don't receive Update event #2627

mtszkarbowiak opened this issue May 20, 2024 · 4 comments · Fixed by #2637
Labels
bug Something isn't working ui
Milestone

Comments

@mtszkarbowiak
Copy link
Contributor

mtszkarbowiak commented May 20, 2024

Issue description:

Custom UI controls don't receive invokes on override void Update(float deltaTime) event method. This breaks existing controls.

Steps to reproduce:

  1. Create a custom control.
  2. Declare aforementioned overriding method.

Flax version:

1.8, I think it was NOT in 1.7

@Tryibion
Copy link
Member

Tryibion commented May 22, 2024

Works fine for me... even runs while not in play mode. Do you have any code that can reproduce this issue?

@mtszkarbowiak
Copy link
Contributor Author

I was preparing the code when it clicked it my brain: Update is not invoked if the checkbox Receives Events for the canvas is checked off. The comment for this checkbox says though that it should be used to disable input events.

@Tryibion
Copy link
Member

I see. I guess the question is, should it call update if that is uncheck marked? there could be inputs firing in the update loop....

@mtszkarbowiak
Copy link
Contributor Author

I think it should. My understanding is the following:

  1. Creating a canvas which does not receive input is useful. It may be used for Player's HUD which never interacts with mouse, just displays info.
  2. Such canvas should still be update-able. For example health bars, map markers, etc. Time dependence allows for animations. That's why it takes delta time as a param.
  3. Control has separate Update and Draw to distinguish the process of drawing and updating state, meaning that the engine may draw the control multiple times between updates, and vice versa. (As I remember Unity can do that.)
  4. Ultimately, to modify if a script is updating, the engine uses Enabled. If so, the controls should follow it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ui
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants