SceneTree

SceneTree manages a hierarchy of nodes.

As one of the most important classes, the SceneTree manages the hierarchy of nodes in a scene as well as scenes themselves. Nodes can be added, retrieved and removed. The whole scene tree (and thus the current scene) can be paused. Scenes can be loaded, switched and reloaded. You can also use the SceneTree to organize your nodes into groups: every node can be assigned as many groups as you want to create, e.g. a "enemy" group. You can then iterate these groups or even call methods and set properties on all the group's members at once.

@GodotBaseClass
struct SceneTree {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

Constants
enum Constants
GroupCallFlags
enum GroupCallFlags
StretchAspect
enum StretchAspect
StretchMode
enum StretchMode

Functions

_changeScene
void _changeScene(GodotObject arg0)
_connectedToServer
void _connectedToServer()
_connectionFailed
void _connectionFailed()
_networkPeerConnected
void _networkPeerConnected(long arg0)
_networkPeerDisconnected
void _networkPeerDisconnected(long arg0)
_serverDisconnected
void _serverDisconnected()
callGroup
Variant callGroup(StringArg0 group, StringArg1 method, VarArgs varArgs)

Calls method on each member of the given group.

callGroupFlags
Variant callGroupFlags(long flags, StringArg1 group, StringArg2 method, VarArgs varArgs)

Calls method on each member of the given group, respecting the given groupcallflags.

changeScene
GodotError changeScene(StringArg0 path)

Changes to the scene at the given path.

changeSceneTo
GodotError changeSceneTo(PackedScene packed_scene)

Changes to the given PackedScene.

createTimer
Ref!SceneTreeTimer createTimer(double time_sec, bool pause_mode_process)

Returns a SceneTreeTimer which will SceneTreeTimer.timeout after the given time in seconds elapsed in this SceneTree. If pause_mode_process is set to false, pausing the SceneTree will also pause the timer.

getCurrentScene
Node getCurrentScene()
getEditedSceneRoot
Node getEditedSceneRoot()
getFrame
long getFrame()
getMultiplayer
Ref!MultiplayerAPI getMultiplayer()
getNetworkConnectedPeers
PoolIntArray getNetworkConnectedPeers()

Returns the peer IDs of all connected peers of this SceneTree's networkPeer.

getNetworkPeer
Ref!NetworkedMultiplayerPeer getNetworkPeer()
getNetworkUniqueId
long getNetworkUniqueId()

Returns the unique peer ID of this SceneTree's networkPeer.

getNodeCount
long getNodeCount()

Returns the number of nodes in this SceneTree.

getNodesInGroup
Array getNodesInGroup(StringArg0 group)

Returns all nodes assigned to the given group.

getRoot
Viewport getRoot()
getRpcSenderId
long getRpcSenderId()

Returns the sender's peer ID for the most recently received RPC call.

hasGroup
bool hasGroup(StringArg0 name)

Returns true if the given group exists.

hasNetworkPeer
bool hasNetworkPeer()

Returns true if there is a networkPeer set.

isDebuggingCollisionsHint
bool isDebuggingCollisionsHint()
isDebuggingNavigationHint
bool isDebuggingNavigationHint()
isInputHandled
bool isInputHandled()

Returns true if the most recent InputEvent was marked as handled with setInputAsHandled.

isMultiplayerPollEnabled
bool isMultiplayerPollEnabled()
isNetworkServer
bool isNetworkServer()

Returns true if this SceneTree's networkPeer is in server mode (listening for connections).

isPaused
bool isPaused()
isRefusingNewNetworkConnections
bool isRefusingNewNetworkConnections()
isUsingFontOversampling
bool isUsingFontOversampling()
notifyGroup
void notifyGroup(StringArg0 group, long notification)

Sends the given notification to all members of the group.

notifyGroupFlags
void notifyGroupFlags(long call_flags, StringArg1 group, long notification)

Sends the given notification to all members of the group, respecting the given groupcallflags.

opAssign
SceneTree opAssign(T n)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(SceneTree other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
queueDelete
void queueDelete(GodotObject obj)

Queues the given object for deletion, delaying the call to GodotObject.free to after the current frame.

quit
void quit()

Quits the application.

reloadCurrentScene
GodotError reloadCurrentScene()

Reloads the currently active scene.

setAutoAcceptQuit
void setAutoAcceptQuit(bool enabled)

If true the application automatically accepts quitting.

setCurrentScene
void setCurrentScene(GodotObject child_node)
setDebugCollisionsHint
void setDebugCollisionsHint(bool enable)
setDebugNavigationHint
void setDebugNavigationHint(bool enable)
setEditedSceneRoot
void setEditedSceneRoot(GodotObject scene)
setGroup
void setGroup(StringArg0 group, StringArg1 property, VariantArg2 value)

Sets the given property to value on all members of the given group.

setGroupFlags
void setGroupFlags(long call_flags, StringArg1 group, StringArg2 property, VariantArg3 value)

Sets the given property to value on all members of the given group, respecting the given groupcallflags.

setInputAsHandled
void setInputAsHandled()

Marks the most recent input event as handled.

setMultiplayer
void setMultiplayer(MultiplayerAPI multiplayer)
setMultiplayerPollEnabled
void setMultiplayerPollEnabled(bool enabled)
setNetworkPeer
void setNetworkPeer(NetworkedMultiplayerPeer peer)
setPause
void setPause(bool enable)
setQuitOnGoBack
void setQuitOnGoBack(bool enabled)

If true the application quits automatically on going back (e.g. on Android).

setRefuseNewNetworkConnections
void setRefuseNewNetworkConnections(bool refuse)
setScreenStretch
void setScreenStretch(long mode, long aspect, Vector2 minsize, double shrink)

Configures screen stretching to the given stretchmode, stretchaspect, minimum size and shrink.

setUseFontOversampling
void setUseFontOversampling(bool enable)

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

currentScene
Node currentScene [@property getter]
GodotObject currentScene [@property setter]

The current scene.

debugCollisionsHint
bool debugCollisionsHint [@property getter]
bool debugCollisionsHint [@property setter]
debugNavigationHint
bool debugNavigationHint [@property getter]
bool debugNavigationHint [@property setter]
editedSceneRoot
Node editedSceneRoot [@property getter]
GodotObject editedSceneRoot [@property setter]

The root of the edited scene.

multiplayer
MultiplayerAPI multiplayer [@property setter]

The default MultiplayerAPI instance for this SceneTree.

multiplayer
MultiplayerAPI multiplayer [@property getter]

The default MultiplayerAPI instance for this SceneTree.

multiplayerPoll
bool multiplayerPoll [@property getter]
bool multiplayerPoll [@property setter]

If true (default) enable the automatic polling of the MultiplayerAPI for this SceneTree during idleFrame. When false you need to manually call MultiplayerAPI.poll for processing network packets and delivering RPCs/RSETs. This allows to run RPCs/RSETs in a different loop (e.g. physics, thread, specific time step) and for manual Mutex protection when accessing the MultiplayerAPI from threads.

networkPeer
NetworkedMultiplayerPeer networkPeer [@property getter]
NetworkedMultiplayerPeer networkPeer [@property setter]

The peer object to handle the RPC system (effectively enabling networking when set). Depending on the peer itself, the SceneTree will become a network server (check with isNetworkServer()) and will set root node's network mode to master (see NETWORK_MODE_* constants in Node), or it will become a regular peer with root node set to puppet. All child nodes are set to inherit the network mode by default. Handling of networking-related events (connection, disconnection, new clients) is done by connecting to SceneTree's signals.

paused
bool paused [@property getter]
bool paused [@property setter]

If true the SceneTree is paused. Doing so will have the following behavior: 2D and 3D physics will be stopped. _process and _physics_process will not be called anymore in nodes. _input and _input_event will not be called anymore either.

refuseNewNetworkConnections
bool refuseNewNetworkConnections [@property getter]
bool refuseNewNetworkConnections [@property setter]

If true the SceneTree's networkPeer refuses new incoming connections.

root
Viewport root [@property getter]

The SceneTree's Viewport.

useFontOversampling
bool useFontOversampling [@property getter]
bool useFontOversampling [@property setter]

If true font oversampling is used.

Static functions

_new
SceneTree _new()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

_classBinding
struct _classBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
ToRef as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta