You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What does this code mean:
There is an asset defenition in code_loader.rs. Asset with a plain text from .rs file. main.rs algorithm:
Loading folder of .rs files.
Convert all HandleUntyped types to Handle<Code>.
Save it to Resource with Vec<Handle<Code>>.
Start watch for changes.
If a file has been loaded or modified, prints its content.
What you expected to happen
In most situations one file of the three is tracked, rarely two of three, sometimes no one.
In the next example i'm loading two files from folder, one is tracked or no one.
Handles [
StrongHandle<Code>(AssetPathId(AssetPathId(SourcePathId(13027041954229367283), LabelId(6298619649789039366)))),
StrongHandle<Code>(AssetPathId(AssetPathId(SourcePathId(9312919904264361102), LabelId(6298619649789039366)))),
]
Created WeakHandle<Code>(AssetPathId(AssetPathId(SourcePathId(13027041954229367283), LabelId(6298619649789039366))))
Content "// Example\nfn main() {\n println!(\"Hello World, from short string!\");\n}\n"
Created WeakHandle<Code>(AssetPathId(AssetPathId(SourcePathId(9312919904264361102), LabelId(6298619649789039366))))
Content "// Example\nfn main() {\n println!(\"Hello World, from this very long string!\");\n}\n"
Modified WeakHandle<Code>(AssetPathId(AssetPathId(SourcePathId(9312919904264361102), LabelId(6298619649789039366))))
Content "// Example 1\nfn main() {\n println!(\"Hello World, from this very long string!\");\n}\n"
Modified WeakHandle<Code>(AssetPathId(AssetPathId(SourcePathId(13027041954229367283), LabelId(6298619649789039366))))
Content "// Example 1\nfn main() {\n println!(\"Hello World, from short string!\");\n}\n"
What actually happened
Handles [
StrongHandle<Code>(AssetPathId(AssetPathId(SourcePathId(13027041954229367283), LabelId(6298619649789039366)))),
StrongHandle<Code>(AssetPathId(AssetPathId(SourcePathId(9312919904264361102), LabelId(6298619649789039366)))),
]
Created WeakHandle<Code>(AssetPathId(AssetPathId(SourcePathId(13027041954229367283), LabelId(6298619649789039366))))
Content "// Example\nfn main() {\n println!(\"Hello World, from short string!\");\n}\n"
Created WeakHandle<Code>(AssetPathId(AssetPathId(SourcePathId(9312919904264361102), LabelId(6298619649789039366))))
Content "// Example\nfn main() {\n println!(\"Hello World, from this very long string!\");\n}\n"
Modified WeakHandle<Code>(AssetPathId(AssetPathId(SourcePathId(9312919904264361102), LabelId(6298619649789039366))))
Content "// Example 1\nfn main() {\n println!(\"Hello World, from this very long string!\");\n}\n"
The text was updated successfully, but these errors were encountered:
Calling AssetServer::watch_for_changes() initialises the filesystem watcher synchronously. Calling AssetServer::load_folder() eventually spawns a call to the internal AssetServer::load_async() as a task on a TaskPool. That is, it is called asynchronously and after load_folder() returns, the timing of those tasks executing can and will vary. At the end of load_async(), the path to the asset is added to the patches to be watched, but only if the filesystem watcher has been initialised and exists.
Hopefully from this description of how the code works, it is clear that this code is racey. I discovered this while investigating inconsistency in how hot-reloading was working and fixing it here: #3643
You could also try enabling the watcher first, and then calling load_folder.
Bevy version
[package]
name = "experimental"
version = "0.1.0"
edition = "2021"
[dependencies]
anyhow = "1.0.52"
[dependencies.bevy]
version = "0.6.0"
default-features = false
features = [
"filesystem_watcher",
"bevy_dynamic_plugin",
"render",
"bevy_winit",
"png",
"x11",
]
Operating system & version
Operating System: Manjaro Linux
KDE Plasma Version: 5.23.4
KDE Frameworks Version: 5.89.0
Qt Version: 5.15.2
Kernel Version: 5.15.12-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 4 × Intel® Pentium® CPU 3825U @ 1.90GHz
Memory: 7.7 Gb of RAM
Graphics Processor: Mesa Intel® HD Graphics
What you did
code_loader.rs
main.rs
What does this code mean:
There is an asset defenition in code_loader.rs. Asset with a plain text from .rs file.
main.rs algorithm:
Handle<Code>
.Vec<Handle<Code>>
.What you expected to happen
In most situations one file of the three is tracked, rarely two of three, sometimes no one.
In the next example i'm loading two files from folder, one is tracked or no one.
What actually happened
The text was updated successfully, but these errors were encountered: