-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Using sprite atlas with the UI #1169
Comments
Could you post the backtrace for that error, just so we can see where it's actually located? Thanks |
Sure @alec-deason :) This is when I run it with RUST_BACKTRACE=1
|
Heh, that looks very familiar. I think it's the same failure path as #682, though with a different underlying cause. In both cases the failure occurs because the FlexSurface is expecting a child that isn't found, in this case because it's missing the Style component and in the #682 case because the entities are created too late in the frame and the Changed query filter misses it's chance to see them. |
since #1180 got merged, this should not panic, but instead should log a warning. Could you check if it's better with current master? |
I ended up doing the same thing than @shosanna on master and now I got the message:
So at least the error message is now clear and no crash occur. |
I can display sprites inside the UI by ensuring that have Style, CalculatedSize and Node:
Adding |
This workaround doesn't quite work for me - I end up with the sprite being rendered twice: once as part of the UI and once as part of the normal set of game entities. Presumably two separate systems end up picking it up and rendering it. |
Any news on this? |
There's a PR addressing this here: #3792 |
FWIW until that feature is implemented, here is another workaround approach. For me it worked nicely to add an extra camera with order > 0, UI disabled and a separate render layer and use that to display whatever I can render on top of the UI. Biggest downside of course is you have to add the calculations for adjusting that cameras viewport to where on screen it should up in your window if the window is resized or something changes in your UI layout for some other reason. |
Implemented in #8822 |
What problem does this solve or what need does it fill?
I would like to be able to use something like
SpriteSheetBundle
but for the UI. I have my UI sprites in an atlas and it would be convenient to be able to use it and not have to export the individual images withImageBundle
Describe the solution would you like?
To be able to use
SpriteSheetBundle
as a UI element - be able to style it and position it, etc.Describe the alternative(s) you've considered?
Additional context
I did not know it is not possible and I was actually trying to do something like this:
And it did not work. I understand it is because I am mixing UI and non-UI elements but I think the error message should be more helpful, I was really struggling to understand what is wrong. The error I got:
So I think a bit nicer error message would be also welcome for every other beginner out there like I am :)
Thanks!
The text was updated successfully, but these errors were encountered: