Comments (6)
Does it panic if you move that same resource access into a custom widget?
My guess is that we actually don't have access to World
at this point.
from kayak_ui.
Seems to be that way. I hadn't yet ventured into custom widgets yet. Building a custom widget that checks world.is_err()
as in the full_ui
example does not panic.
from kayak_ui.
Hm, yeah it probably is:
kayak_ui/bevy_kayak_ui/src/bevy_context.rs
Lines 40 to 49 in f90c054
I think the only way to achieve this unfortunately would be to do so within a widget— where World
access is guaranteed— rather than within the constructor function for BevyContext
.
This means that we should probably make query_world
a pub(crate)
access instead of a pub
one so other users don't stumble upon the same issue. This should be okay since the only pub
access (that I know of) is here:
kayak_ui/bevy_kayak_ui/src/lib.rs
Lines 73 to 78 in f90c054
So that will probably need to be dealt with as well (perhaps by just simply moving the process_event
system into the update
system).
from kayak_ui.
BevyContext::new(
wont have access to world here. Another suggestion would be to load in the resource via the create_ui
system.
from kayak_ui.
Another suggestion would be to load in the resource via the
create_ui
system.
Actually, yeah this might be a simpler solution assuming you can pass the resource into the closure (which is probably trivial for your RandomResource
type since it could implement Copy
).
from kayak_ui.
Since solutions to the problem above have been suggested I'm going to close this for now. Feel free to open up a new issue if you feel there is more to do here.
from kayak_ui.
Related Issues (20)
- Use Dashmap to replace `Rwlock<Hashmap>`
- UI materials have some usability friction when used to bevy shaders
- UI materials do not seem to respect z-ordering
- Quads with borders cannot have a transparent background HOT 1
- Using multiple shader materials causes them to render on eachother's elements
- Small text gets white boxes
- tree::should_remove_root test failed
- Make `Tree` have internal mutablity
- hello_world example is blank when copied into project HOT 3
- Input lag HOT 1
- Text Rendering Inverted HOT 2
- Is there a way to import Chinese fonts? HOT 1
- Add support for text outlines
- Dynamically rendering widgets inside the rsx! block ? HOT 1
- Consider removing the 'Styles' (KStyle) as an input, only leaving ComputedStyles
- I dont understand why widgets wrapped inside of a ContextProvider need to have a 'computed styles' HOT 1
- Consider removing 'computed styles' entirely from custom widgets
- Missing example: mouse cursor position to render position
- Can't query custom widget props HOT 1
- Font loading from subdirectories fails for nested .ttf files
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kayak_ui.