Signal2
Signal support.
MultiplayerSpawner.swift:419class Signal2
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (12) members.
Types
class Signal1
Signal support.
Type members
Instance members
var despawned: Signal1
Emitted when a spawnable scene or custom spawn was despawned by the multiplayer authority. Only called on puppets.
var spawnFunction: Callable
Method called on all peers when for every custom
spawn(data:)
requested by the authority. Will receive thedata
parameter, and should return aNode
that is not in the scene tree.var spawnLimit: UInt32
Maximum nodes that is allowed to be spawned by this spawner. Includes both spawnable scenes and custom spawns.
var spawnPath: NodePath
Path to the spawn root. Spawnable scenes that are added as direct children are replicated to other peers.
var spawned: Signal2
Emitted when a spawnable scene or custom spawn was spawned by the multiplayer authority. Only called on puppets.
func addSpawnableScene(path: String
) 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
spawnPath
.func clearSpawnableScenes(
) Clears all spawnable scenes. Does not despawn existing instances on remote peers.
func getSpawnableScene(index: Int32
) -> String Returns the spawnable scene path by index.
func getSpawnableSceneCount(
) -> Int32 Returns the count of spawnable scene paths.
func spawn(data: Variant
) -> Node? Requests a custom spawn, with
data
passed tospawnFunction
on all peers. Returns the locally spawned node instance already inside the scene tree, and added as a child of the node pointed byspawnPath
.
Citizens in SwiftGodot
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ node: Node) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)