🤖 Fix proofreading issues in bevy skills
- Fix `ref` keyword used as variable name in code examples - Fix "retries next tick" → systems continue on normal schedule - Fix `State::set()` → `NextState::set()` in upgrade skill - Fix `SceneRoot` → `WorldAssetRoot` for 0.19 consistency - Fix Replace lifecycle event description (overwritten, not removed) - Fix grep patterns (quoting, trailing spaces) - Remove third-party physics/networking content (not Bevy built-ins)
This commit is contained in:
@@ -44,7 +44,7 @@ The highest-frequency mistakes. When in doubt, trust this table over memory:
|
||||
|------|--------|
|
||||
| Resources are components | Resources live on entities; `Query<Entity>` matches them — filter broad queries with `Without<IsResource>`. Cannot derive both `Component` and `Resource` on one type. |
|
||||
| Scene renamed | `Scene`/`SceneRoot` → `WorldAsset`/`WorldAssetRoot` |
|
||||
| `Ref<T>.clone()` | Returns `Ref<T>`, not the inner value — use `ref.deref().clone()` |
|
||||
| `Ref<T>.clone()` | Returns `Ref<T>`, not the inner value — use `my_ref.deref().clone()` |
|
||||
| `Assets::get_mut` | Returns `AssetMut<A>` (mutation-tracked), not `&mut A` |
|
||||
| GLTF materials | Return `GltfMaterial`; use `#Material0/std` label for `StandardMaterial` |
|
||||
|
||||
@@ -68,7 +68,7 @@ struct Player;
|
||||
|
||||
### Systems
|
||||
|
||||
Plain functions of `SystemParam`s. Make fallible systems return `Result` (0.18+) — errors log and the system retries next tick; `?` works with anything convertible to `BevyError`:
|
||||
Plain functions of `SystemParam`s. Make fallible systems return `Result` (0.18+) — errors are logged via `BevyError` and the system continues running on its normal schedule; `?` works with anything convertible to `BevyError`:
|
||||
|
||||
```rust
|
||||
fn apply_damage(mut q: Query<&mut Health>, mut reader: MessageReader<Damage>) -> Result {
|
||||
@@ -156,7 +156,7 @@ Bevy often succeeds silently when misconfigured. If something "doesn't show up"
|
||||
6. **Assets aren't ready after `load()`** — gate on `AssetEvent::LoadedWithDependencies` or `is_loaded_with_dependencies()`.
|
||||
7. **Raw `ButtonInput<MouseButton>` fires through UI** — world click handlers need UI-consumption checks.
|
||||
|
||||
More production gotchas (physics, multiplayer/shared-world, custom relationships): `references/production-gotchas.md`.
|
||||
More production gotchas (custom relationships, debugging heuristics): `references/production-gotchas.md`.
|
||||
|
||||
## Code style
|
||||
|
||||
@@ -179,7 +179,7 @@ Load on demand — each is self-contained:
|
||||
| `references/events-observers.md` | Message vs Event APIs, observers, lifecycle events, hooks |
|
||||
| `references/input.md` | Keyboard, mouse, gamepad, touch |
|
||||
| `references/camera-rendering.md` | Cameras, coordinates, meshes, materials, shaders, assets, lighting |
|
||||
| `references/production-gotchas.md` | Silent failures, physics-plugin traps, headless/server architecture |
|
||||
| `references/production-gotchas.md` | Silent failures, headless contexts, debugging heuristics |
|
||||
|
||||
## Related skill
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ Built-in events observers can watch per component:
|
||||
|-------|-------|-------|
|
||||
| `Add` | component added where absent | first |
|
||||
| `Insert` | any insert (add or replace) | after `Add` |
|
||||
| `Replace` | component removed, regardless of replacement | before `Remove` |
|
||||
| `Replace` | component value overwritten by a new insert over an existing value | before `Remove` |
|
||||
| `Remove` | component removed | after `Replace` |
|
||||
| `Despawn` | entity despawned (per component) | last |
|
||||
|
||||
|
||||
@@ -74,17 +74,6 @@ Any system that can run both rendered and headless needs this.
|
||||
|
||||
Custom `#[relationship]` / `#[relationship_target]` pairs auto-sync via hooks. Do not write observers that manually push/remove entities in the target `Vec<Entity>` — that duplicates what the macro does and desyncs.
|
||||
|
||||
## Physics plugins (Avian / Rapier pattern)
|
||||
|
||||
- **`CollidingEntities` is not auto-inserted** with `Collider` (Avian3D 0.5). Without adding `CollidingEntities::default()`, collision queries return nothing while the simulation runs fine internally.
|
||||
- **Removing `RigidBody` from a parent with `Collider` children** can panic with stale internal-tree indices. Despawn collider children first.
|
||||
|
||||
## Shared-world multiplayer (server + client in one process)
|
||||
|
||||
- **Server entities carry no visual components.** `SceneRoot`/`Mesh3d`/`Sprite` belong on client-spawned entities only; mixing causes host-vs-remote visual drift and double maintenance.
|
||||
- **`run_if(is_server)` gates the system, not the query.** In a shared world, server systems still match client replica entities — queries must filter client markers explicitly.
|
||||
- **Shared components race.** Server and client systems in one World share component instances; a client system resetting a timer changes what the server system reads the same frame. Use `Local<T>` for server-side state that must stay independent.
|
||||
|
||||
## Debugging heuristics
|
||||
|
||||
1. Invisible things: check normals, visibility hierarchy, far plane (1000), asset cache poisoning, scene-label spawning.
|
||||
|
||||
Reference in New Issue
Block a user