diff --git a/src/core/event_registry/client_event.rs b/src/core/event_registry/client_event.rs index 4a4a6cd9..3cc57ff3 100644 --- a/src/core/event_registry/client_event.rs +++ b/src/core/event_registry/client_event.rs @@ -367,7 +367,7 @@ unsafe fn send( for event in reader.read(events.deref()) { let mut cursor = Default::default(); event_data - .serialize::(ctx, event, &mut cursor) + .serialize(ctx, event, &mut cursor) .expect("client event should be serializable"); trace!("sending event `{}`", any::type_name::()); @@ -390,7 +390,7 @@ unsafe fn receive( let events: &mut Events> = events.deref_mut(); for (client_id, message) in server.receive(event_data.channel_id) { let mut cursor = Cursor::new(&*message); - match event_data.deserialize::(ctx, &mut cursor) { + match event_data.deserialize(ctx, &mut cursor) { Ok(event) => { trace!( "applying event `{}` from `{client_id:?}`", @@ -398,7 +398,10 @@ unsafe fn receive( ); events.send(FromClient { client_id, event }); } - Err(e) => debug!("unable to deserialize event from {client_id:?}: {e}"), + Err(e) => debug!( + "ignoring event `{}` from {client_id:?} that failed to deserialize: {e}", + any::type_name::() + ), } } } diff --git a/src/lib.rs b/src/lib.rs index b26857e6..e0490c9e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -483,6 +483,23 @@ To reduce packet size there are the following limits per replication update: - Up to [`u16::MAX`] entities that have changed components with up to [`u16::MAX`] bytes of component data. - Up to [`u16::MAX`] entities that have removed components with up to [`u16::MAX`] bytes of component data. - Up to [`u16::MAX`] entities that were despawned. + +## Troubleshooting + +If you face any issue, try to enable logging to see what is going on. +To enable logging, you can temporarely set `RUST_LOG` environment variable to `bevy_replicon=debug` +(or `bevy_replicon=trace` for more noisy output) like this: + +```bash +RUST_LOG=bevy_replicon=debug cargo run +``` + +The exact method depends on the OS shell. + +Alternatively you can configure [`LogPlugin`](bevy::log::LogPlugin) to make it permanent. + +For deserialization errors on client we use `error` level which should be visible by default. +But on server we use `debug` for it to avoid flooding server logs with errors caused by clients. */ #![cfg_attr(docsrs, feature(doc_auto_cfg))]