-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Auto add default UI camera #3679
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
Conversation
This is a neat idea, thanks for the contribution! Code quality and tests are excellent. I'm of two minds about this idea. In favor:
Against:
If we don't do this, I think we should print a warning instead, using the same schedule position as you have here. Overall, I think I've convinced myself that this is worth it. @Wcubed could you add a resource that controls whether or not this is done, defaulting to true? That will make it simpler to opt-out of this if users really care. |
Good points.
|
I would rather have the UI renderer work without a camera by assuming one with the default value rather than spawn one that could conflict with the user |
If I understand you correctly, you propose that if the ecs world does not contain a ui camera, the render system would assume in the background it has one with the default settings? That would have less edge-cases or gotcha's, I think. Interestingly, it would make the UI camera a bit of a "config object". If it's not there, defaults are assumed, so it's existence would then serve to override those defaults. Not sure if that is the desired direction. For the implementation I think this
|
I agree with @mockersf here that this problem might be better solved by improving the design of other systems. |
Since Bevy 0.8, there isn't a need for a UI camera anymore, and 2D/3D camera will display UI by default |
Adds a system to PostStartup that spawns a default UI camera if it finds UI nodes but no camera to render them.
Partial solution to #1432.
Open question
When there are no UI elements present during startup, the system won't trigger. Elements added later on in the game won't therefore be visible.
One solution to this would be to move the new check from startup to some stage that runs every frame. Would this be overkill? And is there a possibility that a user might have UI nodes, but doesn't want them to be rendered at the moment?