reckfellENGINE

Resource

Shared data, resource-graph copying and change notifications.

On this page
class ResourceReckfellSharpInherits RefCounted

Resource stores data that multiple objects can share. Another C# variable does not create an independent copy. Duplicate() shares nested references; Duplicate(true) copies built-in resources; DuplicateDeep(All) includes external resources, with script and usage-flag exceptions.

ResourcePath manages a shared cache entry rather than saving a file. TakeOverPath() replaces path ownership; SetPathCache() is an internal operation without registration. Save changes separately through ResourceSaver. Do not Dispose a shared cached wrapper while other aliases still use it.

For a custom C# property call EmitChanged() after changing data: [Export] alone emits no automatic notification. ResourceLocalToScene concerns level/prefab handling rather than a separate copy per Entity.

Working with resources, custom format. Windows headless checks cover copy graphs, paths and callbacks. Editor ID caches, actual local PackedEntity instantiation and GPU RIDs were not executed here.

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

Constructors1

ResourceConstructor
# Resource
C#
public Resource();

Creates an owned Resource with empty path/name. Loads no file, registers no format and adds no Entity to a tree. Resources may be shared: choose the appropriate Duplicate mode for independent data rather than another variable pointing to the same object.

Properties4

ResourceLocalToSceneProperty
# ResourceLocalToScene
C#
public bool ResourceLocalToScene { get; set; }

Marks a resource for level/prefab instance-local handling by PackedEntity. Set before instantiation; changing the flag does not retroactively separate shared references. Not uniqueness per every Entity or a network ID. Actual PackedEntity handling was source-reviewed; a standalone flag assigning no GetLocalScene root was executed.

ResourceNameProperty
# ResourceName
C#
public string ResourceName { get; set; }

Display name. Assignment emits Changed even for the same value; renames no file and does not change ResourcePath.

ResourcePathProperty
# ResourcePath
C#
public string ResourcePath { get; set; }

Path and shared-resource cache key, not a file-save command. The setter registers a nonempty path; empty unregisters it. For an occupied path use an intentional TakeOverPath or another path. Current native code rejects a collision after removing this object previous registration and clearing its path, so rollback is not promised. The collision branch was source-reviewed without executing the failing case.

ResourceSceneUniqueIdProperty
# ResourceSceneUniqueId
C#
public string ResourceSceneUniqueId { get; set; }

Local serialized-subresource ID. ASCII letters, digits, underscore and empty are allowed. An invalid character causes native diagnostics and replacement with a generated candidate rather than preserving the old value. Distinct from uid:// and project-wide uniqueness.

Methods26

CopyFromResourceError
# CopyFromResource
C#
public Error CopyFromResource(Resource resource);

Copies STORAGE properties into the existing object while preserving its ResourcePath. Calls ResetState first; nested Resources remain shared rather than deeply copied. Checks the native engine class, not exact C# type equality. A mismatch returns InvalidParameter; null is also invalid. Changed emissions are batched into one pending notification if any occurred; Ok promises neither independent nested data nor disk persistence.

Parameters
NameTypeDefault
resourceResource—
resource

Nonnull source with the same native engine class; nested data need not be independent.

Returns Error

Ok for accepted copying or InvalidParameter for an invalid source/class; not proof of deep independence.

DuplicateResource
# Duplicate
C#
public Resource Duplicate(bool deep = false);

Creates a new root Resource and copies stored properties/script, excluding ResourcePath. Containers and nested resources are shared by default. deep=true copies containers and built-in nested Resources; externally pathed resources normally remain shared. Repeated references to one duplicated resource point to one copy. Property usage flags can override the rule. Use DuplicateDeep(All) for external resources too; custom constructors/scripts can constrain duplication.

Parameters
NameTypeDefault
deepboolfalse
deep

False shares containers/nested references; true recursively copies containers and built-in Resources subject to usage flags.

Returns Resource

New Resource under the selected depth rules; construction failure can yield null and diagnostics.

DuplicateDeepResource
# DuplicateDeep
C#
public Resource DuplicateDeep(Resource.DeepDuplicateMode deepSubresourcesMode = Resource.DeepDuplicateMode.Internal);

Creates a new root and recursively copies Array/Dictionary containers. None shares nested Resources; Internal duplicates built-in ones; All includes external Resources. All does not promise universal independence: scripts and NEVER_DUPLICATE properties may remain shared. A remap preserves repeated references within the copied graph rather than cloning every occurrence separately. Original Resource paths are not copied; nothing is saved to disk.

Parameters
NameTypeDefault
deepSubresourcesModeResource.DeepDuplicateModeResource.DeepDuplicateMode.Internal
deepSubresourcesMode

None, Internal or All: nested-Resource policy, not a switch disabling root/container copying.

Returns Resource

New root with the selected nested-resource policy; an invalid mode/construction failure can yield null.

EmitChangedvoid
# EmitChanged
C#
public void EmitChanged();

Notifies Changed subscribers after a data change. Writes no file and guarantees no refresh of every editor view. Call after an actual change in a custom C# setter; avoid recursively emitting from your own Changed handler. During background loading the native backend may defer notification to the main thread.

GenerateSceneUniqueIdstring
# GenerateSceneUniqueId
C#
public static string GenerateSceneUniqueId();

Creates a short five-character internal-ID candidate. Not a global UID, cryptographic identifier or uniqueness reservation. The current implementation uses a–y and 0–8; do not build a permanent public protocol around that detail. The saving caller handles collisions.

Returns string

Short local-ID candidate, not a globally reserved UID.

GetIdForPathstring
# GetIdForPath
C#
public string GetIdForPath(string path);

Reads the editor ID cache for the pair of referring file path and this resource current ResourcePath. Not ResourceUid or an ID read from an arbitrary file. Returns empty when absent or built without TOOLS_ENABLED. Editor persistence was source-reviewed only.

Parameters
NameTypeDefault
pathstring—
path

Referring file path for the editor ID cache; not a new resource path.

Returns string

Cached ID for the path pair, or empty.

GetLocalSceneEntity
# GetLocalScene
C#
public Entity GetLocalScene();

Returns the Entity root assigned by local-to-scene handling, an available editor context, or null. Setting ResourceLocalToScene=true alone neither creates nor assigns a root. The returned Entity is borrowed; do not Free it as your own temporary object. Actual PackedEntity instantiation was not executed in this pass.

Returns Entity

Borrowed root Entity or null.

GetNamestring
# GetName
C#
public string GetName();

Returns ResourceName, a display name rather than a file path or global registry key.

Returns string

Current display name, possibly empty.

GetPathstring
# GetPath
C#
public string GetPath();

Returns the current ResourcePath string. It may be empty, internal, or set with SetPathCache without registration. Nonempty does not prove a file exists, was loaded or was written.

Returns string

Current path string without a file-existence guarantee.

GetRidRid
# GetRid
C#
public Rid GetRid();

Returns a backend-resource RID when provided by the concrete type. Base Resource returns an empty RID; not an InstanceId. Do not manually free a returned RID still owned by the Resource. IsValid checks a nonzero value, not suitability for every server API.

Returns Rid

Concrete backend-resource RID or empty; not a newly owned object.

GetSceneUniqueIdstring
# GetSceneUniqueId
C#
public string GetSceneUniqueId();

Returns ResourceSceneUniqueId, a local serialized-subresource ID rather than global ResourceUid. Empty is permitted.

Returns string

Local serialized-subresource ID, possibly empty.

IsBuiltInbool
# IsBuiltIn
C#
public bool IsBuiltIn();

Classifies by path: empty, containing ::, or starting with local:// counts as built-in. Deep duplication uses this rule; it validates neither file presence, saving nor Entity ownership.

Returns bool

True under the built-in path-string classification.

IsLocalToScenebool
# IsLocalToScene
C#
public bool IsLocalToScene();

Returns the ResourceLocalToScene flag. True does not prove this instance has already been duplicated or assigned an Entity root.

Returns bool

Current local-to-scene flag.

ResetStatevoid
# ResetState
C#
public void ResetState();

Calls _ResetState for state the concrete class must clear itself. The base implementation does not automatically zero every exported property, name or path. CopyFromResource calls this hook before copying.

SetIdForPathvoid
# SetIdForPath
C#
public void SetIdForPath(string path, string id);

Writes the editor ID cache for a referring file and current ResourcePath. Empty id removes the entry. Assigns no ResourceUid, saves no file and registers no new resource path. Does nothing without TOOLS_ENABLED; editor workflow was not executed here.

Parameters
NameTypeDefault
pathstring—
idstring—
path

Referring file path for the editor ID cache; not a new resource path.

id

Editor-cache ID; empty removes the entry.

SetLocalToScenevoid
# SetLocalToScene
C#
public void SetLocalToScene(bool enable);

Sets ResourceLocalToScene. Creates no immediate copy, rewires no existing references and assigns no GetLocalScene root.

Parameters
NameTypeDefault
enablebool—
enable

Flag for local-to-scene handling, not an immediate copy command.

SetNamevoid
# SetName
C#
public void SetName(string name);

Sets ResourceName and emits Changed, including for the same value. Performs no file rename.

Parameters
NameTypeDefault
namestring—
name

Display name; empty is allowed, not a file path.

SetPathvoid
# SetPath
C#
public void SetPath(string path);

Sets ResourcePath with ordinary cache registration. Writes/moves no file. A path occupied by another resource produces native diagnostics; current implementation has already cleared this object previous path at that point. Use TakeOverPath for intentional ownership replacement; SetPathCache has different raw-path semantics.

Parameters
NameTypeDefault
pathstring—
path

New path string; not a file write/move command. SetPathCache bypasses registration; SetPath/TakeOverPath change it.

SetPathCachevoid
# SetPathCache
C#
public void SetPathCache(string path);

Internally changes the path string and invokes _SetPathCache, bypassing ResourceCache registration. Not equivalent to ResourcePath/SetPath. Do not use to ordinarily move a cached object: this operation maintains no cache-entry consistency. Tested on an unregistered QA object.

Parameters
NameTypeDefault
pathstring—
path

New path string; not a file write/move command. SetPathCache bypasses registration; SetPath/TakeOverPath change it.

SetSceneUniqueIdvoid
# SetSceneUniqueId
C#
public void SetSceneUniqueId(string id);

Sets local ResourceSceneUniqueId. ASCII letters, digits and underscore are permitted; empty is accepted. For an invalid character native code assigns a generated ID and emits diagnostics. Writes no file and reserves no global uniqueness.

Parameters
NameTypeDefault
idstring—
id

Local ID using ASCII letters, digits and underscore; empty is allowed.

SetupLocalToScenevoid · Deprecated
# SetupLocalToScene
C#
public void SetupLocalToScene();

SDK-obsolete internal method. Emits SetupLocalToSceneRequested then calls _SetupLocalToScene. Does not itself duplicate the resource or enable local-to-scene. Override _SetupLocalToScene in ordinary user classes instead of manually calling this method; internal dispatch was exercised only by deliberate QA.

TakeOverPathvoid
# TakeOverPath
C#
public void TakeOverPath(string path);

Assigns a resource path while replacing its cache owner. Existing references keep the previous owner alive, but its ResourcePath becomes empty. Subsequent path lookup points to this resource. Moves/saves no files; use only for intentional shared-object replacement.

Parameters
NameTypeDefault
pathstring—
path

New path string; not a file write/move command. SetPathCache bypasses registration; SetPath/TakeOverPath change it.

_GetRidRid
# _GetRid
C#
public virtual Rid _GetRid();

Hook for the concrete resource GetRid. Return a RID of an actually owned backend object or an empty RID. Returning it creates no server object and transfers no ownership to the caller; do not substitute an InstanceId as a RID.

Returns Rid

RID of the owned backend object, or empty.

_ResetStatevoid
# _ResetState
C#
public virtual void _ResetState();

Override to clear your own nonstored/dynamic state. Called by ResetState, including before CopyFromResource. Do not recursively call ResetState from the hook; no automatic reset of all properties is provided.

_SetPathCachevoid
# _SetPathCache
C#
public virtual void _SetPathCache(string path);

Notification after internal SetPathCache. The path is already assigned; the hook substitutes for neither ResourcePath registration nor file-operation confirmation. Do not recursively call SetPathCache here.

Parameters
NameTypeDefault
pathstring—
path

New path string; not a file write/move command. SetPathCache bypasses registration; SetPath/TakeOverPath change it.

_SetupLocalToScenevoid
# _SetupLocalToScene
C#
public virtual void _SetupLocalToScene();

Override to initialize a resource in local-to-scene handling. GetLocalScene can supply the assigned root; check for null outside normal instantiation. Not an every-Entity constructor or _Ready. Standalone callback dispatch was tested; actual PackedEntity local duplication was not executed in this pass.

Signals and events2

ChangedEvent
# Changed
C#
public event Action Changed;

Change notification, not an automatic disk save. ResourceName emits even when assigned the same value. An ordinary custom C# [Export] setter does not emit automatically: call EmitChanged after a meaningful change. Shared references observe the same object.

SetupLocalToSceneRequestedEvent · Deprecated
# SetupLocalToSceneRequested
C#
public event Action SetupLocalToSceneRequested;

SDK-obsolete: override _SetupLocalToScene for resource initialization instead of subscribing here. Native setup emits this event before the callback; the event itself proves neither duplication nor a level root.

Resource.DeepDuplicateMode

ValueDescription
All = 2

Every subresource found will be duplicated, even if it has a non-local path. In other words, even potentially big resources stored separately will be duplicated.

Internal = 1

Only subresources without a path or with a scene-local path will be duplicated.

None = 0

No subresources at all are duplicated. This is useful even in a deep duplication to have all the arrays and dictionaries duplicated but still pointing to the original resources.

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.