Signal2
Signal support.
SceneTree.swift:1541class 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 (48) members.
Types
enum GroupCallFlags
class Signal1
Signal support.
class Signal3
Signal support.
class Signal4
Signal support.
Type members
static func createFrom(nativeHandle: UnsafeMutableRawPointer
) -> SceneTree Public because we want to allow the embed API to call this, but dont want to make it obvious in the constructors
class var godotClassName: StringName
Instance members
var autoAcceptQuit: Bool
If
true
, the application automatically accepts quitting requests.var currentScene: Node?
The root node of the currently loaded main scene, usually as a direct child of
root
. See alsochangeSceneToFile(path:)
,changeSceneToPacked(packedScene:)
, andreloadCurrentScene
.var debugCollisionsHint: Bool
If
true
, collision shapes will be visible when running the game from the editor for debugging purposes.var debugPathsHint: Bool
If
true
, curves fromPath2D
andPath3D
nodes will be visible when running the game from the editor for debugging purposes.var editedSceneRoot: Node?
The root of the scene currently being edited in the editor. This is usually a direct child of
root
.var multiplayerPoll: Bool
If
true
(default value), enables automatic polling of theMultiplayerAPI
for this SceneTree during [signal process_frame].var nodeAdded: Signal1
Emitted when the
node
enters this tree.var nodeConfigurationWarningChanged: Signal4
Emitted when the
node
’supdateConfigurationWarnings
is called. Only emitted in the editor.var nodeRemoved: Signal2
Emitted when the
node
exits this tree.var nodeRenamed: Signal3
Emitted when the
node
’sname
is changed.var paused: Bool
If
true
, the scene tree is considered paused. This causes the following behavior:var physicsFrame: SimpleSignal
Emitted immediately before
_physicsProcess(delta:)
is called on every node in this tree.var physicsInterpolation: Bool
If
true
, the renderer will interpolate the transforms of physics objects between the last two transforms, so that smooth motion is seen even when physics ticks do not coincide with rendered frames.var processFrame: SimpleSignal
Emitted immediately before
_process(delta:)
is called on every node in this tree.var quitOnGoBack: Bool
If
true
, the application quits automatically when navigating back (e.g. using the system “Back” button on Android).var root: Window?
The tree’s root
Window
. This is top-mostNode
of the scene tree, and is always present. An absoluteNodePath
always starts from this node. Children of the root node may include the loadedcurrentScene
, as well as any AutoLoad configured in the Project Settings.var treeChanged: SimpleSignal
Emitted any time the tree’s hierarchy changes (nodes being moved, renamed, etc.).
var treeProcessModeChanged: SimpleSignal
Emitted when the
processMode
of any node inside the tree is changed. Only emitted in the editor, to update the visibility of disabled nodes.func callGroup(StringName, method: StringName, Variant...
) Calls
method
on each node inside this tree added to the givengroup
. You can pass arguments tomethod
by specifying them at the end of this method call. Nodes that cannot callmethod
(either because the method doesn’t exist or the arguments do not match) are ignored. See alsosetGroup(_:property:value:)
andnotifyGroup(_:notification:)
.func callGroupFlags(Int64, group: StringName, method: StringName, Variant...
) Calls the given
method
on each node inside this tree added to the givengroup
. Useflags
to customize this method’s behavior (seeGroupCallFlags
). Additional arguments formethod
can be passed at the end of this method. Nodes that cannot callmethod
(either because the method doesn’t exist or the arguments do not match) are ignored.func changeSceneToFile(path: String
) -> GodotError Changes the running scene to the one at the given
path
, after loading it into aPackedScene
and creating a new instance.func changeSceneToPacked(packedScene: PackedScene?
) -> GodotError Changes the running scene to a new instance of the given
PackedScene
(which must be valid).func createTimer(timeSec: Double, processAlways: Bool, processInPhysics: Bool, ignoreTimeScale: Bool
) -> SceneTreeTimer? Returns a new
SceneTreeTimer
. AftertimeSec
in seconds have passed, the timer will emit [signal SceneTreeTimer.timeout] and will be automatically freed.func createTween(
) -> Tween? Creates and returns a new
Tween
processed in this tree. The Tween will start automatically on the next process frame or physics frame (depending on itsTween.TweenProcessMode
).func getFirstNodeInGroup(StringName
) -> Node? Returns the first
Node
found inside the tree, that has been added to the givengroup
, in scene hierarchy order. Returnsnull
if no match is found. See alsogetNodesInGroup(_:)
.func getFrame(
) -> Int Returns how many frames have been processed, since the application started. This is not a measurement of elapsed time.
func getMultiplayer(forPath: NodePath
) -> MultiplayerAPI? Searches for the
MultiplayerAPI
configured for the given path, if one does not exist it searches the parent paths until one is found. If the path is empty, or none is found, the default one is returned. SeesetMultiplayer(_:rootPath:)
.func getNodeCount(
) -> Int32 Returns the number of nodes inside this tree.
func getNodeCountInGroup(StringName
) -> Int32 Returns the number of nodes assigned to the given group.
func getNodesInGroup(StringName
) -> ObjectCollection<Node> Returns an
GArray
containing all nodes inside this tree, that have been added to the givengroup
, in scene hierarchy order.func getProcessedTweens(
) -> ObjectCollection<Tween> Returns an
GArray
of currently existingTween
s in the tree, including paused tweens.func hasGroup(name: StringName
) -> Bool Returns
true
if a node added to the given groupname
exists in the tree.func notifyGroup(StringName, notification: Int32
) Calls
notification(what:reversed:)
with the givennotification
to all nodes inside this tree added to thegroup
. See alsocallGroup(_:method:)
andsetGroup(_:property:value:)
.func notifyGroupFlags(callFlags: UInt32, group: StringName, notification: Int32
) Calls
notification(what:reversed:)
with the givennotification
to all nodes inside this tree added to thegroup
. UsecallFlags
to customize this method’s behavior (seeGroupCallFlags
).func queueDelete(obj: Object?
) Queues the given
obj
to be deleted, calling itsObject/free()
at the end of the current frame. This method is similar toqueueFree
.func quit(exitCode: Int32
) Quits the application at the end of the current iteration, with the given
exitCode
.func reloadCurrentScene(
) -> GodotError Reloads the currently active scene, replacing
currentScene
with a new instance of its originalPackedScene
.func setGroup(StringName, property: String, value: Variant
) Sets the given
property
tovalue
on all nodes inside this tree added to the givengroup
. Nodes that do not have theproperty
are ignored. See alsocallGroup(_:method:)
andnotifyGroup(_:notification:)
.func setGroupFlags(callFlags: UInt32, group: StringName, property: String, value: Variant
) Sets the given
property
tovalue
on all nodes inside this tree added to the givengroup
. Nodes that do not have theproperty
are ignored. UsecallFlags
to customize this method’s behavior (seeGroupCallFlags
).func setMultiplayer(MultiplayerAPI?, rootPath: NodePath
) Sets a custom
MultiplayerAPI
with the givenrootPath
(controlling also the relative subpaths), or override the default one ifrootPath
is empty.func unloadCurrentScene(
) If a current scene is loaded, calling this method will unload it.
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:_:)