Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
Table of contents
-
var spawn_function: Callable -
var spawn_limit: int = 0 -
var spawn_path: NodePath = NodePath("") -
func add_spawnable_scene(path: String) -> void -
func clear_spawnable_scenes() -> void -
const func get_spawnable_scene(index: int) -> String -
const func get_spawnable_scene_count() -> int -
func spawn(data: Variant = null) -> Node -
signal despawned(node: Node) -
signal spawned(node: Node)
MultiplayerSpawner #
is_instantiable, Node, core, not_builtin_classes
Automatically replicates spawnable nodes from the authority to other multiplayer peers.
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.
Members #
var spawn_function: Callable#
Method called on all peers when a custom spawn is requested by the authority. Will receive the data parameter, and should return a Node that is not in the scene tree.
Note: The returned node should not be added to the scene with Node.add_child. This is done automatically.
var spawn_limit: int = 0#
Maximum number of nodes allowed to be spawned by this spawner. Includes both spawnable scenes and custom spawns.
When set to 0 (the default), there is no limit.
var spawn_path: NodePath = NodePath("")#
Path to the spawn root. Spawnable scenes that are added as direct children are replicated to other peers.
Methods #
func add_spawnable_scene(path: String) -> void#
Adds a scene path to spawnable scenes, making it automatically replicated from the multiplayer authority to other peers when added as children of the node pointed by spawn_path.
func clear_spawnable_scenes() -> void#
Clears all spawnable scenes. Does not despawn existing instances on remote peers.
const func get_spawnable_scene(index: int) -> String#
Returns the spawnable scene path by index.
const func get_spawnable_scene_count() -> int#
Returns the count of spawnable scene paths.
func spawn(data: Variant = null) -> Node#
Requests a custom spawn, with data passed to spawn_function on all peers. Returns the locally spawned node instance already inside the scene tree, and added as a child of the node pointed by spawn_path.
Note: Spawnable scenes are spawned automatically. spawn is only needed for custom spawns.
Annotations #
Constants #
Constructors #
Enums #
Operators #
Signals #
signal despawned(node: Node)#
Emitted when a spawnable scene or custom spawn was despawned by the multiplayer authority. Only called on remote peers.
signal spawned(node: Node)#
Emitted when a spawnable scene or custom spawn was spawned by the multiplayer authority. Only called on remote peers.