reckfellENGINE

PackedEntity

Packing and instantiating level and prefab hierarchies.

On this page
class PackedEntityReckfellSharpInherits Resource

PackedEntity is a Resource containing a serialized hierarchy. .rscene denotes a level and .rprefab a prefab; the source asset path determines the role rather than a separate Entity subclass.

Creation flow: Instantiate() → validate result → AddChild(). Before tree entry the root does not receive ordinary _Ready. Free() unused instances. Generic variants create the root before casting; a mismatch has no automatic cleanup.

For runtime packing, assign descendant Owner to the appropriate root, then check Pack(). Packing is in memory; save a file separately through ResourceSaver. Persistent groups/connections are stored rather than every temporary subscription.

Ordinary resources may be shared between instances; ResourceLocalToScene separates resources during instantiation. GetState() provides shared metadata, not a detached snapshot.

Creating instances, resources. Windows headless checks cover an owned C# hierarchy; editor modes, inheritance, positive placeholders and file save/load were not executed here.

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

Constructors1

PackedEntityConstructor
# PackedEntity
C#
public PackedEntity();

Creates an empty serialized-hierarchy container with a PackedEntityState. Before successful Pack/loading CanInstantiate is false. This is a Resource rather than a live Entity; add the Instantiate result to the tree.

Properties1

_BundledProperty
# _Bundled
C#
public Reckfell.Collections.Dictionary _Bundled { get; set; }

Internal serialization Dictionary schema, not a stable level-editing API or user save-game format. The setter restores state from linked arrays/indices; arbitrary key edits can break structure. Use Pack for ordinary creation and GetState for inspection. Only a valid owned-QA bundle roundtrip was executed; malformed data was not.

Methods6

CanInstantiatebool
# CanInstantiate
C#
public bool CanInstantiate();

Checks only whether state contains Entity records. True proves neither available scripts/dependencies nor every property correctness or a successful future Instantiate. Returns false for a newly empty PackedEntity.

Returns bool

True only for nonempty state, not guaranteed creation success.

GetStatePackedEntityState
# GetState
C#
public PackedEntityState GetState();

Returns the current shared serialization state, not a snapshot or live tree. Repeated access can return the same C# wrapper. Pack/ResetState change data visible through a held reference. Do not Dispose the shared wrapper while the PackedEntity or other code uses it; keep the owner alive for ordinary inspection.

Returns PackedEntityState

This resource shared PackedEntityState, not an independent copy.

Instantiate2 overloads
# Instantiate · 1/2
C#
public Entity Instantiate(PackedEntity.GenEditState editState = PackedEntity.GenEditState.Disabled);

Creates a new Entity hierarchy with stored properties, groups and connections restored. Does not call AddChild or guarantee _Ready before tree entry. The result owner must attach the root or Free an unused root; its children are freed with it. Local-to-scene resources are separated per instance while ordinary resources may remain shared. Normally use GenEditState.Disabled. Native creation failure can return null and diagnostics.

Parameters
NameTypeDefault
editStatePackedEntity.GenEditStatePackedEntity.GenEditState.Disabled
editState

Disabled for ordinary runtime. Other modes serve the editor and require tools; not a quality/asynchronous setting.

Returns Entity

New Entity root or null on native failure; the owner must attach or free the result.

# Instantiate · 2/2
C#
public T Instantiate<T>(PackedEntity.GenEditState editState = PackedEntity.GenEditState.Disabled) where T : class;

Creates a new Entity hierarchy with stored properties, groups and connections restored. Does not call AddChild or guarantee _Ready before tree entry. The result owner must attach the root or Free an unused root; its children are freed with it. Local-to-scene resources are separated per instance while ordinary resources may remain shared. Normally use GenEditState.Disabled. Native creation failure can return null and diagnostics. The generic wrapper casts the already created root to T and can throw InvalidCastException. It does not Free a rejected root; retain a nongeneric Instantiate result before checking an unknown type.

Parameters
NameTypeDefault
editStatePackedEntity.GenEditStatePackedEntity.GenEditState.Disabled
editState

Disabled for ordinary runtime. Other modes serve the editor and require tools; not a quality/asynchronous setting.

Returns T

New Entity root or null on native failure; the owner must attach or free the result. A mismatching T throws InvalidCastException.

InstantiateOrNullT
# InstantiateOrNull
C#
public T InstantiateOrNull<T>(PackedEntity.GenEditState editState = PackedEntity.GenEditState.Disabled) where T : class;

Creates the native hierarchy first, then applies C# as T. A type mismatch returns null, but the wrapper does not free the root already created. Not a safe pre-instantiation type test. When the type is unknown, retain an ordinary Instantiate result, use is T, and explicitly Free a rejected root. Matching types were executed; mismatch was source-reviewed only.

Parameters
NameTypeDefault
editStatePackedEntity.GenEditStatePackedEntity.GenEditState.Disabled
editState

Disabled for ordinary runtime. Other modes serve the editor and require tools; not a quality/asynchronous setting.

Returns T

Created root as T or null; type mismatch does not free the native root.

PackError
# Pack
C#
public Error Pack(Entity path);

Serializes a live hierarchy into this PackedEntity in memory, not a file. Despite its name, path is an Entity root. Parenthood alone is insufficient: set Owner to the appropriate root for ordinary added descendants; unsuitable descendants are omitted. Stores persistent groups/connections and stored properties rather than all runtime state. The source tree stays alive. A new Pack replaces prior state; parsing failure can clear it, with no atomic rollback promised. Call ResourceSaver.Save separately for disk persistence.

Parameters
NameTypeDefault
pathEntity—
path

Live Entity root to pack, not a filename string; account for descendant Owner.

Returns Error

Ok for accepted packing or an Error; not proof of disk persistence.

PackedEntity.GenEditState

ValueDescription
Disabled = 0

Normal instantiation without an editing mode. Use this default value at runtime.

Instance = 1

An instance editing mode that prepares its local resources. Available only in editor builds; use Disabled for normal gameplay.

Main = 2

An editing mode for the main open level, with local resource preparation. Only the main edited root should receive this state. Available only in editor builds.

MainInherited = 3

A Main variant for a hierarchy instantiated as the base of an inherited level or prefab. Available only in editor builds.

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.