Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

MultiplayerSpawner

Inherits: Node < Object

Automatically replicates spawnable nodes from the authority to other multiplayer peers.

Description

Spawnable scenes can be configured in the editor or through code (see add_spawnable_scene).

Also supports custom node spawns through spawn, calling spawn_function on all peers.

Internally, MultiplayerSpawner uses MultiplayerAPI.object_configuration_add to notify spawns passing the spawned node as the object and itself as the configuration, and MultiplayerAPI.object_configuration_remove to notify despawns in a similar way.

Properties

Callable

spawn_function

int

spawn_limit

0

NodePath

spawn_path

NodePath("")

Methods

void

add_spawnable_scene ( String path )

void

clear_spawnable_scenes ( )

String

get_spawnable_scene ( int index ) const

int

get_spawnable_scene_count ( ) const

Node

spawn ( Variant data=null )


Signals

despawned ( Node node )

Emitted when a spawnable scene or custom spawn was despawned by the multiplayer authority. Only called on puppets.


spawned ( Node node )

Emitted when a spawnable scene or custom spawn was spawned by the multiplayer authority. Only called on puppets.


Property Descriptions