Migration Guide

May 8, 2026 · View on GitHub

Before/after snippets for every breaking change in the post-cleanup API. Each block shows the old code (marked // BEFORE) and the new code (marked // AFTER).


spawn_static_entityspawn_entity().as_static()

// BEFORE
server.spawn_static_entity(&mut world)
    .insert_component(tile);

// AFTER
server.spawn_entity(&mut world)
    .as_static()
    .insert_component(tile);

.as_static() must be called before the first .insert_component().


insert_static_resourceinsert_resource(..., true)

// BEFORE
server.insert_static_resource(&mut world, map_metadata)?;

// AFTER
server.insert_resource(&mut world, map_metadata, true)?;

insert_resource now requires is_static: bool

// BEFORE
server.insert_resource(&mut world, scoreboard)?;

// AFTER
server.insert_resource(&mut world, scoreboard, false)?;

WorldEvents<E>Events<E> (client)

// BEFORE
use naia_client::WorldEvents;
let events: WorldEvents<E> = client.take_world_events();

// AFTER
use naia_client::Events;
let events: Events<E> = client.take_world_events();

make_roomcreate_room

// BEFORE
let room = server.make_room();

// AFTER
let room = server.create_room();

resource_countresources_count

// BEFORE
let n = server.resource_count();

// AFTER
let n = server.resources_count();

room_countrooms_count (on UserRef)

// BEFORE
let n = server.user(&user_key).room_count();

// AFTER
let n = server.user(&user_key).rooms_count();

Client ReplicationConfigPublicity

// BEFORE
use naia_client::ReplicationConfig;
client.entity_mut(&mut world, &entity)
    .configure_replication(ReplicationConfig::Public);

// AFTER
use naia_client::Publicity;
client.entity_mut(&mut world, &entity)
    .configure_replication(Publicity::Public);

send_message returns Result on the server

// BEFORE
server.send_message::<GameChannel, _>(&user_key, &msg);

// AFTER
server.send_message::<GameChannel, _>(&user_key, &msg)?;
// or handle the error explicitly:
if let Err(e) = server.send_message::<GameChannel, _>(&user_key, &msg) {
    // user disconnected between taking events and sending — safe to ignore
}

insert_components removed from server EntityMut

// BEFORE
entity_mut.insert_components(vec![Box::new(position), Box::new(health)]);

// AFTER
entity_mut.insert_component(position);
entity_mut.insert_component(health);