bevy_sync 0.19.1

Plugin for synchronizing entities and components between server and its clients.
Documentation
use bevy::prelude::Camera3d;
use bevy_app::{App, Startup};
use bevy_camera::{primitives::Aabb, visibility::Visibility};
use bevy_ecs::system::Commands;
use bevy_internal::DefaultPlugins;
use bevy_light::PointLight;
use bevy_math::Vec3;
use bevy_mesh::Mesh3d;
use bevy_pbr::{MeshMaterial3d, StandardMaterial, wireframe::Wireframe};
use bevy_sync::{ConnectCommand, prelude::*};
use bevy_transform::components::Transform;
use std::{
    env,
    net::{IpAddr, Ipv4Addr},
};

fn main() {
    if env::var("RUST_LOG").is_err() {
        unsafe { env::set_var("RUST_LOG", "bevy_sync=debug") }
    }

    let ip = IpAddr::V4(Ipv4Addr::LOCALHOST);
    let port = 4000;
    let asset_port = 4900;

    let mut client = App::new();
    client.add_plugins(DefaultPlugins);
    client.add_plugins(SyncPlugin);
    client.sync_component::<Aabb>();
    client.sync_component::<Visibility>();
    client.sync_component::<Transform>();
    client.sync_component::<Wireframe>();
    client.sync_component::<PointLight>();
    client.sync_component::<MeshMaterial3d<StandardMaterial>>();
    client.sync_component::<Mesh3d>();
    client.sync_materials(true);
    client.sync_meshes(true);
    client.sync_audios(true);

    client.add_systems(Startup, load_world);

    client.world_mut().commands().queue(ConnectCommand {
        is_host: false,
        config: SyncConnectionParameters::Direct {
            ip,
            port,
            asset_port,
        },
    });

    client.run();
}

fn load_world(mut commands: Commands) {
    commands.spawn((
        Camera3d::default(),
        Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
    ));
}