Skip to content

App.init_resource vs App.insert_resource #20198

Closed Answered by tim-blackbird
HQ2000-Rust asked this question in Q&A
Discussion options

You must be logged in to vote

The primary difference is that init_resource won't overwrite the resource if it was already inserted before. This way, you can ensure that a resource exists in one plugin, while still allowing some other plugin or user to insert a specific value. This is mostly useful for Bevy itself and third-party libraries.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HQ2000-Rust
Comment options

Answer selected by HQ2000-Rust
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants