EntityTree
Manages active Entities, the current level, groups and pause.
EntityTree is the main loop and active hierarchy; an Entity obtains it with GetTree after entry. Root is the main Viewport. CurrentScene is the current level root rather than every Root child; assigning it alone neither adds nor frees objects.
A successful replacement request detaches the old level immediately and temporarily leaves CurrentScene null; SceneChanged follows attachment and _Ready of the new root. Autoloads under Root survive replacement. Native APIs accept both PackedEntity roles; a .rscene-only policy belongs to the application. Replacement is not streaming.
Paused controls processing and ordinary physics simulation without prohibiting methods, signals or direct group calls. CreateTimer keeps running during pause by default. Groups query active-tree members rather than all project assets.
Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.
Constructors1
EntityTreeConstructor
public EntityTree();Properties11
AutoAcceptQuitProperty
public bool AutoAcceptQuit { get; set; }Automatically exits on the main window CloseRequested signal. Enabled by default. Disable before implementing confirmation; this does not disable QuitOnGoBack or intercept direct Quit() calls.
CurrentSceneProperty
public Entity CurrentScene { get; set; }The current level root under Root; temporarily null during replacement. Assignment neither adds a new object nor releases the old one.
DebugCollisionsHintProperty
public bool DebugCollisionsHint { get; set; }If true, collision shapes will be visible when running the game from the editor for debugging purposes.
DebugNavigationHintProperty
public bool DebugNavigationHint { get; set; }If true, navigation polygons will be visible when running the game from the editor for debugging purposes.
Note: This property is not designed to be changed at run-time. Changing the value of EntityTree.DebugNavigationHint while the project is running will not have the desired effect.
DebugPathsHintProperty
public bool DebugPathsHint { get; set; }If true, curves from Path2D and Path3D entities will be visible when running the game from the editor for debugging purposes.
Note: This property is not designed to be changed at run-time. Changing the value of EntityTree.DebugPathsHint while the project is running will not have the desired effect.
EditedSceneRootProperty
public Entity EditedSceneRoot { get; set; }The root of the scene currently being edited in the editor. This is usually a direct child of EntityTree.Root.
Note: This property does nothing in release builds.
MultiplayerPollProperty
public bool MultiplayerPoll { get; set; }If true (default value), enables automatic polling of the MultiplayerApi for this EntityTree during EntityTree.ProcessFrame.
If false, you need to manually call MultiplayerApi.Poll to process network packets and deliver RPCs. This allows running RPCs in a different loop (e.g. physics, thread, specific time step) and for manual Mutex protection when accessing the MultiplayerApi from threads.
PausedProperty
public bool Paused { get; set; }Pauses ordinary physics simulation and changes processing through ProcessMode. Does not prohibit signals, direct methods or every timer.
PhysicsInterpolationProperty
public bool PhysicsInterpolation { get; set; }If true, the renderer will interpolate the transforms of objects (both physics and non-physics) between the last two transforms, so that smooth motion is seen even when physics ticks do not coincide with rendered frames.
The default value of this property is controlled by ProjectSettings.physics/common/physics_interpolation.
Note: Although this is a global setting, finer control of individual branches of the EntityTree is possible using Entity.PhysicsInterpolationMode.
QuitOnGoBackProperty
public bool QuitOnGoBack { get; set; }Automatically exits on the main window GoBackRequested signal. Enabled by default and independent of AutoAcceptQuit. Disable it and handle NotificationWMGoBackRequest when Back requires custom confirmation.
RootProperty
public Window Root { get; }The tree's root Window. This is top-most Entity of the scene tree, and is always present. An absolute EntityPath always starts from this entity. Children of the root entity may include the loaded EntityTree.CurrentScene, as well as any AutoLoad($DOCS_URL/tutorials/scripting/singletons_autoload.html) configured in the Project Settings.
Warning: Do not delete this entity. This will result in unstable behavior, followed by a crash.
Methods49
CallGroup2 overloads
public void CallGroup(StringName group, StringName method, params Variant[] args);Immediately invokes a member method. Does not filter by Paused/ProcessMode or create a C# type contract from a group name.
| Name | Type | Default |
|---|---|---|
group | StringName | — |
method | StringName | — |
args | Variant[] | — |
public void CallGroup(StringName group, StringName method, ReadOnlySpan<Variant> args);Immediately invokes a member method. Does not filter by Paused/ProcessMode or create a C# type contract from a group name.
| Name | Type | Default |
|---|---|---|
group | StringName | — |
method | StringName | — |
args | ReadOnlySpan<Variant> | — |
CallGroupFlags2 overloads
public void CallGroupFlags(long flags, StringName group, StringName method, params Variant[] args);Deferred queues calls. Unique coalesces group + method only with Deferred and retains the first arguments. In the checked implementation a Unique flush does not retain Reverse.
| Name | Type | Default |
|---|---|---|
flags | long | — |
group | StringName | — |
method | StringName | — |
args | Variant[] | — |
public void CallGroupFlags(long flags, StringName group, StringName method, ReadOnlySpan<Variant> args);Deferred queues calls. Unique coalesces group + method only with Deferred and retains the first arguments. In the checked implementation a Unique flush does not retain Reverse.
| Name | Type | Default |
|---|---|---|
flags | long | — |
group | StringName | — |
method | StringName | — |
args | ReadOnlySpan<Variant> | — |
ChangeSceneToEntityError
public Error ChangeSceneToEntity(Entity node);Requests deferred replacement with a root not yet inside the active tree. An in-memory object can have no source asset path.
| Name | Type | Default |
|---|---|---|
node | Entity | — |
ErrorChangeSceneToFileError
public Error ChangeSceneToFile(string path);Loads PackedEntity and requests deferred current-level replacement. Error.Ok does not mean the new CurrentScene is ready; wait for SceneChanged. The native API accepts both tree roles.
| Name | Type | Default |
|---|---|---|
path | string | — |
ErrorChangeSceneToPackedError
public Error ChangeSceneToPacked(PackedEntity packedScene);Changes the running scene to a new instance of the given PackedEntity (which must be valid).
Returns OK on success, ERR_CANT_CREATE if the scene cannot be instantiated, or ERR_INVALID_PARAMETER if the scene is invalid.
Note: See EntityTree.ChangeSceneToEntity for details on the order of operations.
| Name | Type | Default |
|---|---|---|
packedScene | PackedEntity | — |
ErrorCreateTimerEntityTreeTimer
public EntityTreeTimer CreateTimer(double timeSec, bool processAlways = true, bool processInPhysics = false, bool ignoreTimeScale = false);Creates a one-shot EntityTreeTimer. processAlways defaults to true, running during pause; false pauses a gameplay wait. This is not a Timer Entity.
| Name | Type | Default |
|---|---|---|
timeSec | double | — |
processAlways | bool | true |
processInPhysics | bool | false |
ignoreTimeScale | bool | false |
EntityTreeTimerCreateTweenTween
public Tween CreateTween();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 its Tween.TweenProcessMode).
Note: A Tween created using this method is not bound to any Entity. It may keep working until there is nothing left to animate. If you want the Tween to be automatically killed when the Entity is freed, use Entity.CreateTween or Tween.BindEntity.
TweenGetCurrentSceneEntity
public Entity GetCurrentScene();EntityGetEditedSceneRootEntity
public Entity GetEditedSceneRoot();EntityGetEntitiesInGroupReckfell.Collections.Array<Entity>
public Reckfell.Collections.Array<Entity> GetEntitiesInGroup(StringName group);Returns active-tree group members. A detached object may retain IsInGroup = true while absent here.
| Name | Type | Default |
|---|---|---|
group | StringName | — |
Reckfell.Collections.Array<Entity>GetEntityCountint
public int GetEntityCount();Returns the number of entities inside this tree.
intGetEntityCountInGroupint
public int GetEntityCountInGroup(StringName group);Counts active members, not disk assets containing the group name.
| Name | Type | Default |
|---|---|---|
group | StringName | — |
intGetFirstEntityInGroupEntity
public Entity GetFirstEntityInGroup(StringName group);Returns the first Entity found inside the tree, that has been added to the given group, in scene hierarchy order. Returns null if no match is found. See also EntityTree.GetEntitiesInGroup.
| Name | Type | Default |
|---|---|---|
group | StringName | — |
EntityGetFramelong
public long GetFrame();Returns how many physics process steps have been processed, since the application started. This is not a measurement of elapsed time. See also EntityTree.PhysicsFrame. For the number of frames rendered, see Engine.GetProcessFrames.
longGetMultiplayerMultiplayerApi
public MultiplayerApi GetMultiplayer(EntityPath forPath = null);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. See EntityTree.SetMultiplayer.
| Name | Type | Default |
|---|---|---|
forPath | EntityPath | null |
MultiplayerApiGetProcessedTweensReckfell.Collections.Array<Tween>
public Reckfell.Collections.Array<Tween> GetProcessedTweens();Returns an Reckfell.Collections.Array of currently existing Tweens in the tree, including paused tweens.
Reckfell.Collections.Array<Tween>GetRootWindow
public Window GetRoot();WindowHasGroupbool
public bool HasGroup(StringName name);Returns true if a entity added to the given group name exists in the tree.
| Name | Type | Default |
|---|---|---|
name | StringName | — |
boolIsAccessibilityEnabledbool
public bool IsAccessibilityEnabled();Returns true if accessibility features are enabled, and accessibility information updates are actively processed.
boolIsAccessibilitySupportedbool
public bool IsAccessibilitySupported();Returns true if accessibility features are supported by the OS and enabled in project settings.
boolIsAutoAcceptQuitbool
public bool IsAutoAcceptQuit();boolIsDebuggingCollisionsHintbool
public bool IsDebuggingCollisionsHint();boolIsDebuggingNavigationHintbool
public bool IsDebuggingNavigationHint();boolIsDebuggingPathsHintbool
public bool IsDebuggingPathsHint();boolIsMultiplayerPollEnabledbool
public bool IsMultiplayerPollEnabled();boolIsPausedbool
public bool IsPaused();boolIsPhysicsInterpolationEnabledbool
public bool IsPhysicsInterpolationEnabled();boolIsQuitOnGoBackbool
public bool IsQuitOnGoBack();boolNotifyGroupvoid
public void NotifyGroup(StringName group, int notification);Sends a notification code to member _Notification methods. This is not a signal with arbitrary arguments; a direct call is not blocked by pause.
| Name | Type | Default |
|---|---|---|
group | StringName | — |
notification | int | — |
NotifyGroupFlagsvoid
public void NotifyGroupFlags(uint callFlags, StringName group, int notification);Calls ReckfellObject.Notification with the given notification to all entities inside this tree added to the group. Use call_flags to customize this method's behavior (see EntityTree.GroupCallFlags).
| Name | Type | Default |
|---|---|---|
callFlags | uint | — |
group | StringName | — |
notification | int | — |
QueueDeletevoid
public void QueueDelete(ReckfellObject obj);Queues the given obj to be deleted, calling its ReckfellObject.Free at the end of the current frame. This method is similar to Entity.QueueFree.
| Name | Type | Default |
|---|---|---|
obj | ReckfellObject | — |
Quitvoid
public void Quit(int exitCode = 0);Requests engine-loop termination and sets the process exit code. Does not propagate NotificationWMCloseRequest, confirm exit or save the game. Await required operations before calling.
| Name | Type | Default |
|---|---|---|
exitCode | int | 0 |
exitCodeProcess exit code; defaults to 0. Returning code 23 was verified in the installed Windows build.
ReloadCurrentSceneError
public Error ReloadCurrentScene();Reloads the current root SourceAssetPath. Restores file state rather than current modified fields. Requires a current root and a source file.
ErrorSetAutoAcceptQuitvoid
public void SetAutoAcceptQuit(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetCurrentScenevoid
public void SetCurrentScene(Entity childNode);| Name | Type | Default |
|---|---|---|
childNode | Entity | — |
SetDebugCollisionsHintvoid
public void SetDebugCollisionsHint(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetDebugNavigationHintvoid
public void SetDebugNavigationHint(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetDebugPathsHintvoid
public void SetDebugPathsHint(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetEditedSceneRootvoid
public void SetEditedSceneRoot(Entity scene);| Name | Type | Default |
|---|---|---|
scene | Entity | — |
SetGroupvoid
public void SetGroup(StringName group, string property, Variant value);Sets the given property to value on all entities inside this tree added to the given group. entities that do not have the property are ignored. See also EntityTree.CallGroup and EntityTree.NotifyGroup.
Note: This method acts immediately on all selected entities at once, which may cause stuttering in some performance-intensive situations.
Note: In C#, property must be in snake_case when referring to built-in Reckfell properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.
| Name | Type | Default |
|---|---|---|
group | StringName | — |
property | string | — |
value | Variant | — |
SetGroupFlagsvoid
public void SetGroupFlags(uint callFlags, StringName group, string property, Variant value);Sets the given property to value on all entities inside this tree added to the given group. entities that do not have the property are ignored. Use call_flags to customize this method's behavior (see EntityTree.GroupCallFlags).
Note: In C#, property must be in snake_case when referring to built-in Reckfell properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.
| Name | Type | Default |
|---|---|---|
callFlags | uint | — |
group | StringName | — |
property | string | — |
value | Variant | — |
SetMultiplayervoid
public void SetMultiplayer(MultiplayerApi multiplayer, EntityPath rootPath = null);Sets a custom MultiplayerApi with the given root_path (controlling also the relative subpaths), or override the default one if root_path is empty.
Note: No MultiplayerApi must be configured for the subpath containing root_path, nested custom multiplayers are not allowed. I.e. if one is configured for "/root/Foo" setting one for "/root/Foo/Bar" will cause an error.
Note: EntityTree.SetMultiplayer should be called before the child entities are ready at the given root_path. If multiplayer entities like MultiplayerSpawner or MultiplayerSynchronizer are added to the tree before the custom multiplayer API is set, they will not work.
| Name | Type | Default |
|---|---|---|
multiplayer | MultiplayerApi | — |
rootPath | EntityPath | null |
SetMultiplayerPollEnabledvoid
public void SetMultiplayerPollEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetPausevoid
public void SetPause(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetPhysicsInterpolationEnabledvoid
public void SetPhysicsInterpolationEnabled(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
SetQuitOnGoBackvoid
public void SetQuitOnGoBack(bool enabled);| Name | Type | Default |
|---|---|---|
enabled | bool | — |
UnloadCurrentScenevoid
public void UnloadCurrentScene();Immediately frees the current root and clears CurrentScene. Do not access its objects afterward.
Signals and events9
EntityAddedEvent
public event EntityTree.EntityAddedEventHandler EntityAdded;Emitted when the entity enters this tree.
| Name | Type | Default |
|---|---|---|
node | Entity | — |
EntityRemovedEvent
public event EntityTree.EntityRemovedEventHandler EntityRemoved;Emitted when the entity exits this tree.
| Name | Type | Default |
|---|---|---|
node | Entity | — |
EntityRenamedEvent
public event EntityTree.EntityRenamedEventHandler EntityRenamed;Emitted when the entity's Entity.Name is changed.
| Name | Type | Default |
|---|---|---|
node | Entity | — |
NodeConfigurationWarningChangedEvent
public event EntityTree.NodeConfigurationWarningChangedEventHandler NodeConfigurationWarningChanged;Emitted when the entity's Entity.UpdateConfigurationWarnings is called. Only emitted in the editor.
| Name | Type | Default |
|---|---|---|
node | Entity | — |
PhysicsFrameEvent
public event Action PhysicsFrame;Emitted immediately before Entity._PhysicsProcess is called on every entity in this tree.
ProcessFrameEvent
public event Action ProcessFrame;Emitted immediately before Entity._Process is called on every entity in this tree.
SceneChangedEvent
public event Action SceneChanged;Emitted after the new root is attached and its _Ready completes following successful replacement. Old references may already target freed objects.
TreeChangedEvent
public event Action TreeChanged;Emitted any time the tree's hierarchy changes (entities being moved, renamed, etc.).
TreeProcessModeChangedEvent
public event Action TreeProcessModeChanged;Emitted when the Entity.ProcessMode of any entity inside the tree is changed. Only emitted in the editor, to update the visibility of disabled entities.
EntityTree.GroupCallFlags
| Value | Description |
|---|---|
Default = 0 | Call entities within a group with no special behavior (default). |
Deferred = 2 | Call entities within a group at the end of the current frame (can be either process or physics frame), similar to |
Reverse = 1 | Call entities within a group in reverse tree hierarchy order (all nested children are called before their respective parent entities). |
Unique = 4 | Call entities within a group only once, even if the call is executed many times in the same frame. Must be combined with |