Resource
Summary
Serves as the abstract base class for engine resources backed by native memory and control blocks.
Definition
Namespace: SDT4.Managed.Core.Asset
Assembly: SDT4.Managed.Core.dll
abstract class Resource
Inheritance:
Object ➔ Resource
Implements:
IDisposable
Fields
| Name | Type | Description |
|---|---|---|
protected _isDisposed |
Boolean | Indicates whether the resource has been disposed. |
Properties
| Name | Type | Description |
|---|---|---|
public get; Asset |
AssetId | Gets the AssetId associated with this resource. |
public get; protected set; ControlBlock |
IntPtr | Gets the immutable pointer to the native control block managing this resource's lifetime. |
protected get; ResourcePtr |
IntPtr | Gets the pointer to the underlying native resource instance. |
public get; References |
Int32 | Gets the total number of active references to this asset maintained across native engine systems and the managed runtime. |
ResourcePtr Remarks
This pointer remains stable in standalone builds, but can change during editor sessions when assets are modified or reloaded.
Methods
protected Void Dispose(Boolean disposing)
Summary: Releases the unmanaged resources used by the Resource and optionally releases managed resources.
Parameters:
disposing(Boolean):to release both managed and unmanaged resources; to release only unmanaged resources.
protected virtual Void Finalize()
public Void Dispose()
Summary: Releases all resources held by the Resource instance.
public virtual Boolean Equals(Object? obj)
Summary: Determines whether the specified object is equal to the current resource based on their native control blocks.
Parameters:
obj(Object?): The object to compare with the current instance.
Returns:
- Boolean:
if the specified object is a Resource and shares the same native control block; otherwise, .
public virtual Int32 GetHashCode()
Summary: Serves as the default hash function based on the native control block handle.
Returns:
- Int32: A hash code for the current resource.
public virtual String ToString()
Summary: Returns a string describing the resource, including its control block address, asset identifier, and native type.
Returns:
- String: A formatted string representing the resource state.