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

Generate warnings when incorrectly accessing Transform or GlobalTransform #1439

Closed
aevyrie opened this issue Feb 13, 2021 · 5 comments
Closed
Labels
C-Usability A simple quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy

Comments

@aevyrie
Copy link
Member

aevyrie commented Feb 13, 2021

What problem does this solve or what need does it fill?

Updating Transform late or reading GlobalTransform early are very common issues that result in a number of help requests and bugs in general.

What solution would you like?

Generate a warning in debug mode any time a Transform is ever mutated after GlobalTransform is propagated or a GlobalTransform is accessed before it has been updated that frame.

What alternative(s) have you considered?

  1. Do nothing, accept this as a source of error.
  2. Develop some general method of specifying component dependencies.
  3. Keep positions from the last frame in GlobalTransform and propagate Transforms at the end of the frame to ensure that worst case, systems accessing it will be a frame out of date, but still work. This could be accompanied with an error message.
@alice-i-cecile alice-i-cecile added C-Enhancement A new feature S-Needs-Triage This issue needs to be labelled D-Trivial Nice and easy! A great choice to get started with Bevy and removed C-Enhancement A new feature labels Feb 16, 2021
@MinerSebas
Copy link
Contributor

MinerSebas commented Feb 16, 2021

Something else to consider is that most User Code should only read from GlobalTransform, as its Values are managed and overrriden by Bevy itself.

@mockersf
Copy link
Member

Generate a warning in debug mode

With the general recommendation being "run in release", I wonder if it wouldn't be better to add a "debug" feature enabled by default (probably with a better name though... "training-wheels"? "clippy"?)
I think disabling default features to pick only the ones you want when you release a game is the good thing to do (anyway it's what I do)

@alice-i-cecile alice-i-cecile added C-Usability A simple quality-of-life change that makes Bevy easier to use and removed S-Needs-Triage This issue needs to be labelled labels Feb 17, 2021
@aevyrie aevyrie changed the title Errors when incorrectly accessing Transform or GlobalTransform Generate warnings when incorrectly accessing Transform or GlobalTransform Feb 17, 2021
@Ratysz
Copy link
Contributor

Ratysz commented Feb 17, 2021

Something else to consider is that most User Code should only read from GlobalTransform, as its Values are managed and overrriden by Bevy itself.

#1460 should take care of that.

@alice-i-cecile
Copy link
Member

For reference, this should be improved by #68.

@nicopap
Copy link
Contributor

nicopap commented Apr 18, 2023

GlobalTransform doesn't have a Transform field anymore, and since, #7134 it's not even possible to mutate it.

The 1-frame lag issue is still an open question, but it seems very difficult to design a system to catch it and warn users about it.

@alice-i-cecile alice-i-cecile closed this as not planned Won't fix, can't repro, duplicate, stale Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Usability A simple quality-of-life change that makes Bevy easier to use D-Trivial Nice and easy! A great choice to get started with Bevy
Projects
None yet
Development

No branches or pull requests

6 participants