Misleading error message if wgsl import has bad path
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## Bevy version
Relatively new: 499c978
## What you did
I have a wgsl shader which at the start has:
```wgsl
#import bevy_ui::ui_vertex_output::UiVertexOutput
#import bevy_pbr::rand_f
```
## What went wrong
When trying to use `rand_f`, an error happens:
```
2024-03-06T10:39:12.086331Z ERROR bevy_render::render_resource::pipeline_cache: failed to process shader:
error: required import 'bevy_pbr' not found
┌─ foo.wgsl:14:17
│
14 │ let noise = rand_f(&rng);
│ ^
│
= missing import 'bevy_pbr'
```
## Additional information
### Theories
While typing out this issue I realized my mistake.
The import should be
```wgsl
#import bevy_pbr::utils::rand_f
```
not
```wgsl
#import bevy_pbr::rand_f
```
### Suggested fix
Improve the error message to state that `bevy_pbr::rand_f` does not exist, not the current message which is misleading.
Contributor guide
Assessment
This issue has not been assessed yet.