janhohenheim / foxtrot

The all-in-one Bevy 3D game template for desktop.
Apache License 2.0
630 stars 45 forks source link

UI not showing #317

Closed ptrkrlsrd closed 4 months ago

ptrkrlsrd commented 4 months ago

Hey, I've been testing the template quite a lot and find it super useful, but I'm having one blocking problem which I can't seem to wrap my head around. I'm trying to spawn a basic TextBundle to start creating some game UI, but it seems like I can't see the text unless I hit Q and view it in the 2D viewport using the bevy_editor. Is there anything I have to have in mind when spawning TextBundles in combination with this setup regarding order of spawning, render layers or anything else?

janhohenheim commented 4 months ago

I've got an idea, give me a second

janhohenheim commented 4 months ago

Is it better after this commit? https://github.com/janhohenheim/foxtrot/commit/6cc5e38dee382eb338f7844db2ba31c62af19eb5 The important part is the IsDefaultUiCamera. This is needed because otherwise, UI does not know which camera to render on. I fixed this by using TargetCamera on the dialog box rendered by Yarn Spinner, but the nicer way is to actually just render all UI on that camera automatically with IsDefaultUiCamera.

janhohenheim commented 4 months ago

Closing this for the moment since I'm 99% the linked commit fixes. Feel free to reopen otherwise :)

ptrkrlsrd commented 4 months ago

Hey, sorry for the late reply. Yes, that solved it. Thank you! 🙏

janhohenheim commented 4 months ago

@ptrkrlsrd great to hear :D