reckfellENGINE

EntityTree

Manages active Entities, the current level, groups and pause.

On this page
class EntityTreeReckfellSharpInherits MainLoop

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.

Level replacement · Groups.

Practical guide.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

EntityTreeConstructor
# EntityTree
C#
public EntityTree();

Properties11

AutoAcceptQuitProperty
# AutoAcceptQuit
C#
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
# CurrentScene
C#
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
# DebugCollisionsHint
C#
public bool DebugCollisionsHint { get; set; }

If true, collision shapes will be visible when running the game from the editor for debugging purposes.

DebugNavigationHintProperty
# DebugNavigationHint
C#
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
# DebugPathsHint
C#
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
# EditedSceneRoot
C#
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
# MultiplayerPoll
C#
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
# Paused
C#
public bool Paused { get; set; }

Pauses ordinary physics simulation and changes processing through ProcessMode. Does not prohibit signals, direct methods or every timer.

PhysicsInterpolationProperty
# PhysicsInterpolation
C#
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
# QuitOnGoBack
C#
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
# Root
C#
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
# CallGroup · 1/2
C#
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.

Parameters
NameTypeDefault
groupStringName—
methodStringName—
argsVariant[]—
# CallGroup · 2/2
C#
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.

Parameters
NameTypeDefault
groupStringName—
methodStringName—
argsReadOnlySpan<Variant>—
CallGroupFlags2 overloads
# CallGroupFlags · 1/2
C#
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.

Parameters
NameTypeDefault
flagslong—
groupStringName—
methodStringName—
argsVariant[]—
# CallGroupFlags · 2/2
C#
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.

Parameters
NameTypeDefault
flagslong—
groupStringName—
methodStringName—
argsReadOnlySpan<Variant>—
ChangeSceneToEntityError
# ChangeSceneToEntity
C#
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.

Parameters
NameTypeDefault
nodeEntity—
Returns Error
ChangeSceneToFileError
# ChangeSceneToFile
C#
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.

Parameters
NameTypeDefault
pathstring—
Returns Error
ChangeSceneToPackedError
# ChangeSceneToPacked
C#
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.

Parameters
NameTypeDefault
packedScenePackedEntity—
Returns Error
CreateTimerEntityTreeTimer
# CreateTimer
C#
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.

Parameters
NameTypeDefault
timeSecdouble—
processAlwaysbooltrue
processInPhysicsboolfalse
ignoreTimeScaleboolfalse
Returns EntityTreeTimer
CreateTweenTween
# CreateTween
C#
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.

Returns Tween
GetCurrentSceneEntity
# GetCurrentScene
C#
public Entity GetCurrentScene();
Returns Entity
GetEditedSceneRootEntity
# GetEditedSceneRoot
C#
public Entity GetEditedSceneRoot();
Returns Entity
GetEntitiesInGroupReckfell.Collections.Array<Entity>
# GetEntitiesInGroup
C#
public Reckfell.Collections.Array<Entity> GetEntitiesInGroup(StringName group);

Returns active-tree group members. A detached object may retain IsInGroup = true while absent here.

Parameters
NameTypeDefault
groupStringName—
Returns Reckfell.Collections.Array<Entity>
GetEntityCountint
# GetEntityCount
C#
public int GetEntityCount();

Returns the number of entities inside this tree.

Returns int
GetEntityCountInGroupint
# GetEntityCountInGroup
C#
public int GetEntityCountInGroup(StringName group);

Counts active members, not disk assets containing the group name.

Parameters
NameTypeDefault
groupStringName—
Returns int
GetFirstEntityInGroupEntity
# GetFirstEntityInGroup
C#
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.

Parameters
NameTypeDefault
groupStringName—
Returns Entity
GetFramelong
# GetFrame
C#
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.

Returns long
GetMultiplayerMultiplayerApi
# GetMultiplayer
C#
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.

Parameters
NameTypeDefault
forPathEntityPathnull
Returns MultiplayerApi
GetProcessedTweensReckfell.Collections.Array<Tween>
# GetProcessedTweens
C#
public Reckfell.Collections.Array<Tween> GetProcessedTweens();

Returns an Reckfell.Collections.Array of currently existing Tweens in the tree, including paused tweens.

Returns Reckfell.Collections.Array<Tween>
GetRootWindow
# GetRoot
C#
public Window GetRoot();
Returns Window
HasGroupbool
# HasGroup
C#
public bool HasGroup(StringName name);

Returns true if a entity added to the given group name exists in the tree.

Parameters
NameTypeDefault
nameStringName—
Returns bool
IsAccessibilityEnabledbool
# IsAccessibilityEnabled
C#
public bool IsAccessibilityEnabled();

Returns true if accessibility features are enabled, and accessibility information updates are actively processed.

Returns bool
IsAccessibilitySupportedbool
# IsAccessibilitySupported
C#
public bool IsAccessibilitySupported();

Returns true if accessibility features are supported by the OS and enabled in project settings.

Returns bool
IsAutoAcceptQuitbool
# IsAutoAcceptQuit
C#
public bool IsAutoAcceptQuit();
Returns bool
IsDebuggingCollisionsHintbool
# IsDebuggingCollisionsHint
C#
public bool IsDebuggingCollisionsHint();
Returns bool
IsDebuggingNavigationHintbool
# IsDebuggingNavigationHint
C#
public bool IsDebuggingNavigationHint();
Returns bool
IsDebuggingPathsHintbool
# IsDebuggingPathsHint
C#
public bool IsDebuggingPathsHint();
Returns bool
IsMultiplayerPollEnabledbool
# IsMultiplayerPollEnabled
C#
public bool IsMultiplayerPollEnabled();
Returns bool
IsPausedbool
# IsPaused
C#
public bool IsPaused();
Returns bool
IsPhysicsInterpolationEnabledbool
# IsPhysicsInterpolationEnabled
C#
public bool IsPhysicsInterpolationEnabled();
Returns bool
IsQuitOnGoBackbool
# IsQuitOnGoBack
C#
public bool IsQuitOnGoBack();
Returns bool
NotifyGroupvoid
# NotifyGroup
C#
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.

Parameters
NameTypeDefault
groupStringName—
notificationint—
NotifyGroupFlagsvoid
# NotifyGroupFlags
C#
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).

Parameters
NameTypeDefault
callFlagsuint—
groupStringName—
notificationint—
QueueDeletevoid
# QueueDelete
C#
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.

Parameters
NameTypeDefault
objReckfellObject—
Quitvoid
# Quit
C#
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.

Parameters
NameTypeDefault
exitCodeint0
exitCode

Process exit code; defaults to 0. Returning code 23 was verified in the installed Windows build.

ReloadCurrentSceneError
# ReloadCurrentScene
C#
public Error ReloadCurrentScene();

Reloads the current root SourceAssetPath. Restores file state rather than current modified fields. Requires a current root and a source file.

Returns Error
SetAutoAcceptQuitvoid
# SetAutoAcceptQuit
C#
public void SetAutoAcceptQuit(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetCurrentScenevoid
# SetCurrentScene
C#
public void SetCurrentScene(Entity childNode);
Parameters
NameTypeDefault
childNodeEntity—
SetDebugCollisionsHintvoid
# SetDebugCollisionsHint
C#
public void SetDebugCollisionsHint(bool enable);
Parameters
NameTypeDefault
enablebool—
SetDebugNavigationHintvoid
# SetDebugNavigationHint
C#
public void SetDebugNavigationHint(bool enable);
Parameters
NameTypeDefault
enablebool—
SetDebugPathsHintvoid
# SetDebugPathsHint
C#
public void SetDebugPathsHint(bool enable);
Parameters
NameTypeDefault
enablebool—
SetEditedSceneRootvoid
# SetEditedSceneRoot
C#
public void SetEditedSceneRoot(Entity scene);
Parameters
NameTypeDefault
sceneEntity—
SetGroupvoid
# SetGroup
C#
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.

Parameters
NameTypeDefault
groupStringName—
propertystring—
valueVariant—
SetGroupFlagsvoid
# SetGroupFlags
C#
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.

Parameters
NameTypeDefault
callFlagsuint—
groupStringName—
propertystring—
valueVariant—
SetMultiplayervoid
# SetMultiplayer
C#
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.

Parameters
NameTypeDefault
multiplayerMultiplayerApi—
rootPathEntityPathnull
SetMultiplayerPollEnabledvoid
# SetMultiplayerPollEnabled
C#
public void SetMultiplayerPollEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetPausevoid
# SetPause
C#
public void SetPause(bool enable);
Parameters
NameTypeDefault
enablebool—
SetPhysicsInterpolationEnabledvoid
# SetPhysicsInterpolationEnabled
C#
public void SetPhysicsInterpolationEnabled(bool enabled);
Parameters
NameTypeDefault
enabledbool—
SetQuitOnGoBackvoid
# SetQuitOnGoBack
C#
public void SetQuitOnGoBack(bool enabled);
Parameters
NameTypeDefault
enabledbool—
UnloadCurrentScenevoid
# UnloadCurrentScene
C#
public void UnloadCurrentScene();

Immediately frees the current root and clears CurrentScene. Do not access its objects afterward.

Signals and events9

EntityAddedEvent
# EntityAdded
C#
public event EntityTree.EntityAddedEventHandler EntityAdded;

Emitted when the entity enters this tree.

Handler parameters
NameTypeDefault
nodeEntity—
EntityRemovedEvent
# EntityRemoved
C#
public event EntityTree.EntityRemovedEventHandler EntityRemoved;

Emitted when the entity exits this tree.

Handler parameters
NameTypeDefault
nodeEntity—
EntityRenamedEvent
# EntityRenamed
C#
public event EntityTree.EntityRenamedEventHandler EntityRenamed;

Emitted when the entity's Entity.Name is changed.

Handler parameters
NameTypeDefault
nodeEntity—
NodeConfigurationWarningChangedEvent
# NodeConfigurationWarningChanged
C#
public event EntityTree.NodeConfigurationWarningChangedEventHandler NodeConfigurationWarningChanged;

Emitted when the entity's Entity.UpdateConfigurationWarnings is called. Only emitted in the editor.

Handler parameters
NameTypeDefault
nodeEntity—
PhysicsFrameEvent
# PhysicsFrame
C#
public event Action PhysicsFrame;

Emitted immediately before Entity._PhysicsProcess is called on every entity in this tree.

ProcessFrameEvent
# ProcessFrame
C#
public event Action ProcessFrame;

Emitted immediately before Entity._Process is called on every entity in this tree.

SceneChangedEvent
# SceneChanged
C#
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
# TreeChanged
C#
public event Action TreeChanged;

Emitted any time the tree's hierarchy changes (entities being moved, renamed, etc.).

TreeProcessModeChangedEvent
# TreeProcessModeChanged
C#
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

ValueDescription
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 ReckfellObject.CallDeferred.

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 EntityTree.GroupCallFlags.Deferred to work. Note: Different arguments are not taken into account. Therefore, when the same call is executed with different arguments, only the first call will be performed.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.