reckfellENGINE

EntityPath

An address for an Entity or its property inside a tree.

On this page
class EntityPathReckfellSharp

EntityPath stores a path rather than a native object reference or ownership. Relative names resolve from the calling Entity; /root begins at the active tree main Viewport. . and .. address the current Entity and its parent.

%Name uses UniqueNameInOwner and Owner scopes. Moving within the same scope can retain lookup; renaming requires the new name. asset://, user:// and uid:// address files/assets rather than GetEntity targets.

Practical guide.

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

Constructors2

EntityPath2 overloads
# EntityPath · 1/2
C#
public EntityPath();

Creates a distinct managed wrapper for an empty path. IsEmpty is true, ToString() returns "", IsAbsolute() is false and both component counts are zero. An empty path does not mean the current Entity: use "." for that.

# EntityPath · 2/2
C#
public EntityPath(string path);

Parses /-separated Entity names and :-separated property or resource subnames. For example, "Rig/Sprite2D:position:x" has two Entity names and two subnames. A leading / marks an absolute path; . and .. mean the current Entity and its parent during lookup.

This only parses text: it does not find an Entity, verify a property or load a file. An empty string and, in the current SDK, null produce an empty path. A malformed sequence with an empty subname between colons produces native diagnostics; do not use the constructor as a user-input validator. In C#, use new EntityPath("Rig") or implicit string conversion: there is no ^"Rig" literal.

Parameters
NameTypeDefault
pathstring—
path

Path text. Use file APIs for files; asset:// and user:// are not GetEntity addresses.

Properties1

IsEmptyProperty
# IsEmpty
C#
public bool IsEmpty { get; }

Tests whether native path data is absent. The empty constructor, "" and current null-input handling produce true. ".", "/" and ":position:x" are not empty. This does not test target existence or the managed reference: first ensure path is not null. Use GetEntityOrNull for an optional target.

Methods18

Dispose2 overloads
# Dispose · 1/2
C#
public void Dispose();

Releases the wrapper’s owned native path, unregisters the resource and suppresses finalization. Other independently created wrappers for the same path remain usable. Does not delete the Entity addressed by the path.

Dispose your object once with using. In the current SDK, repeating Dispose() on a previously registered wrapper throws ArgumentException ("Disposable not registered"). Do not call Dispose() manually inside using, dispose borrowed wrappers or use a disposed object as a dictionary key.

# Dispose · 2/2
C#
public void Dispose(bool disposing);

Low-level overload: either flag value releases the native path and unregisters it. This method does not suppress finalization itself. Application code should use parameterless Dispose() or using: directly calling this overload can leave finalization scheduled for an already released resource. Repeated unregistration can throw ArgumentException.

Parameters
NameTypeDefault
disposingbool—
disposing

Disposal-path flag. The current implementation releases the resource for both true and false.

Equals2 overloads
# Equals · 1/2
C#
public bool Equals(EntityPath? other);

Compares the absolute flag and all names and subnames, case-sensitively. Distinct wrappers for an equal path are equal. This does not compare resolved Entities: "Rig/../Sprite2D" and "Sprite2D" can address the same object but have different components. null differs even from an empty wrapper.

Parameters
NameTypeDefault
otherEntityPath—
other

Other path wrapper, or null.

Returns bool

true for an EntityPath with the same parsed value; otherwise false.

# Equals · 2/2
C#
public override bool Equals(object? obj);

Compares with an EntityPath by parsed value; the same reference also matches. A string passed as object is not implicitly converted and does not equal the path; other types and null return false.

Parameters
NameTypeDefault
objobject—
obj

Object to test; only an EntityPath can match.

Returns bool

true for an EntityPath with the same parsed value; otherwise false.

GetAsPropertyPathEntityPath
# GetAsPropertyPath
C#
public EntityPath GetAsPropertyPath();

Returns a new wrapper for a property path. Entity names are joined with / into the first subname, followed by existing subnames; the result becomes relative. "position:x" becomes ":position:x", while "A/B:x" becomes ":A/B:x": it does not traverse separate A and B properties. The source path is unchanged.

An already pure property path keeps its value; an empty path stays empty. The returned wrapper is owned by the caller and needs its own using lifetime. This method only converts the path and does not read a property. In the example, ReadPositionX reads the current Entity2D position x; GetIndexed performs the read.

C#
using Reckfell;

public static class EntityPathExamples
{
    public static string Describe()
    {
        using var path = new EntityPath("../Rig/Sprite2D:position:x");
        return $"{path.GetName(1)}|{path.GetConcatenatedSubNames()}|{path.GetNameCount()}|{path.GetSubNameCount()}";
        // Rig|position:x|3|2
    }

    public static float ReadPositionX(Entity2D target)
    {
        using var source = new EntityPath("position:x");
        using var property = source.GetAsPropertyPath();
        using var value = target.GetIndexed(property);
        return (float)value;
    }
}
Returns EntityPath

New caller-owned wrapper for the converted path, even when the value is unchanged.

GetConcatenatedNamesstring
# GetConcatenatedNames
C#
public string GetConcatenatedNames();

Returns Entity names joined with / as a managed string. Excludes an absolute path’s leading / and everything after the first colon: "/root/Rig:position:x" yields "root/Rig". Does not modify or resolve the path. Check IsEmpty before calling on an empty EntityPath: the native method reports an error and returns an empty string.

Returns string

Names joined with /, without a leading / or subnames. A nonempty pure property path has an empty name string.

GetConcatenatedSubNamesstring
# GetConcatenatedSubNames
C#
public string GetConcatenatedSubNames();

Returns a managed string of subnames joined with :, without a leading colon. "Sprite2D:position:x" yields "position:x"; a nonempty path with no subnames yields "". The exact C# method name is GetConcatenatedSubNames. Check IsEmpty before calling on an empty path: the native implementation reports an error and returns an empty string.

Returns string

Subnames joined with :, or an empty string if none exist. The return type is string, not StringName.

GetHashCodeint
# GetHashCode
C#
public override int GetHashCode();

Returns the native hash of the parsed path, including names, subnames and the absolute flag. Equal paths have equal hashes and work as Dictionary<EntityPath, T> keys; a matching hash does not prove equality. This is not an Entity identifier or a guarantee of format stability across versions. Do not leave a disposed wrapper as a dictionary key.

Returns int

32-bit hash of the current path value; 0 for an empty path.

GetNamestring
# GetName
C#
public string GetName(int idx);

Reads one Entity name before the first colon. . and .. count as names too. Indices start at zero; valid range: 0 <= idx < GetNameCount(). An invalid index or empty path produces native diagnostics and an empty string rather than a guaranteed CLR exception. Check the range before calling.

Parameters
NameTypeDefault
idxint—
idx

Index from 0 through GetNameCount() - 1; negative values are invalid.

Returns string

Requested name as string; on error, an empty string with native diagnostics.

GetNameCountint
# GetNameCount
C#
public int GetNameCount();

Counts Entity names before the first colon. "../Rig/Sprite2D:position:x" yields 3; an absolute path’s leading / is not a name. An empty path returns 0. This counts path components, not found objects.

Returns int

Number of Entity names, including 0.

GetSubNamestring
# GetSubName
C#
public string GetSubName(int idx);

Reads one subname after :, not an Entity name. Indices start at zero; valid range: 0 <= idx < GetSubNameCount(). An invalid index or empty path produces native diagnostics and an empty string rather than a guaranteed CLR exception. Check the range before calling.

Parameters
NameTypeDefault
idxint—
idx

Index from 0 through GetSubNameCount() - 1; negative values are invalid.

Returns string

Requested subname as string; on error, an empty string with native diagnostics.

GetSubNameCountint
# GetSubNameCount
C#
public int GetSubNameCount();

Counts colon-separated subnames, excluding Entity names. "Rig/Sprite2D:position:x" yields 2. An empty path returns 0 without an indexed access.

Returns int

Number of subnames, including 0.

IsAbsolutebool
# IsAbsolute
C#
public bool IsAbsolute();

Tests the parsed path’s leading-/ flag. true does not prove that a target exists. Absolute lookup requires the calling Entity to be in the active tree; its usual root Viewport is named root, hence "/root/...". "/" is a nonempty absolute path with no names, not a replacement for "/root".

Returns bool

true for an absolute path; false for a relative or empty path.

ToStringstring
# ToString
C#
public override string ToString();

Returns the parsed path representation: / for the absolute flag, /-joined names and colon-prefixed subnames. This is not an exact copy of the input: repeated /, a trailing / and a trailing empty : can disappear. . and .. are not automatically simplified. An empty path yields "". Does not validate a target or dispose the wrapper.

Returns string

Parsed path representation; string.Empty for an empty path.

op_Equalitybool
# op_Equality
C#
public static bool operator ==(EntityPath? left, EntityPath? right);

Compares parsed path values rather than managed references or lookup results. Two null references are equal; null differs from an existing empty EntityPath. Case, the absolute flag and subnames participate; . and .. are not simplified for equality.

Parameters
NameTypeDefault
leftEntityPath—
rightEntityPath—
left

Path wrapper to compare, or null.

right

Path wrapper to compare, or null.

Returns bool

true for equal parsed paths or two null references; otherwise false.

op_Implicit2 overloads
# op_Implicit · 1/2
C#
public static implicit operator string(EntityPath? from);

Calls ToString() for an existing wrapper; null converts to null. An existing empty wrapper produces "", not null. Does not transfer ownership or dispose the path.

Parameters
NameTypeDefault
fromEntityPath—
from

Path to read, or null.

Returns string

Path representation, "" for an empty wrapper, or null for an absent reference.

# op_Implicit · 2/2
C#
public static implicit operator EntityPath(string from);

Creates a new managed wrapper, equivalent to new EntityPath(from). This parses a path rather than finding an Entity. Use using for a locally created path; C# has no ^"path" literal.

Parameters
NameTypeDefault
fromstring—
from

Source text; an empty string and current null handling create an empty path.

Returns EntityPath

New caller-owned path wrapper.

op_Inequalitybool
# op_Inequality
C#
public static bool operator !=(EntityPath? left, EntityPath? right);

Negates ==. Compares parsed path values rather than managed references or lookup results. Two null references are equal; null differs from an existing empty EntityPath. Case, the absolute flag and subnames participate; . and .. are not simplified for equality.

Parameters
NameTypeDefault
leftEntityPath—
rightEntityPath—
left

Path wrapper to compare, or null.

right

Path wrapper to compare, or null.

Returns bool

true for different values or null states; otherwise false.

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.