UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
FSparseDelegateStorage Struct Reference

#include <SparseDelegate.h>

Static Public Member Functions

static COREUOBJECT_API void RegisterDelegateOffset (const UObject *OwningObject, FName DelegateName, size_t OffsetToOwner)
 
static COREUOBJECT_API bool Add (const UObject *DelegateOwner, const FName DelegateName, FScriptDelegate Delegate)
 
static COREUOBJECT_API bool AddUnique (const UObject *DelegateOwner, const FName DelegateName, FScriptDelegate Delegate)
 
static COREUOBJECT_API bool Contains (const UObject *DelegateOwner, const FName DelegateName, const FScriptDelegate &Delegate)
 
static COREUOBJECT_API bool Contains (const UObject *DelegateOwner, const FName DelegateName, const UObject *InObject, FName InFunctionName)
 
static COREUOBJECT_API bool Remove (const UObject *DelegateOwner, const FName DelegateName, const FScriptDelegate &Delegate)
 
static COREUOBJECT_API bool Remove (const UObject *DelegateOwner, const FName DelegateName, const UObject *InObject, FName InFunctionName)
 
static COREUOBJECT_API bool RemoveAll (const UObject *DelegateOwner, const FName DelegateName, const UObject *UserObject)
 
static COREUOBJECT_API void Clear (const UObject *DelegateOwner, const FName DelegateName)
 
static COREUOBJECT_API FMulticastScriptDelegateGetMulticastDelegate (const UObject *DelegateOwner, const FName DelegateName)
 
static COREUOBJECT_API TSharedPtr< FMulticastScriptDelegateGetSharedMulticastDelegate (const UObject *DelegateOwner, const FName DelegateName)
 
static COREUOBJECT_API void SetMulticastDelegate (const UObject *DelegateOwner, const FName DelegateName, FMulticastScriptDelegate Delegate)
 
static COREUOBJECT_API FSparseDelegateResolveSparseDelegate (const UObject *OwningObject, FName DelegateName)
 
static COREUOBJECT_API UObjectResolveSparseOwner (const FSparseDelegate &SparseDelegate, const FName OwningClassName, const FName DelegateName)
 
static COREUOBJECT_API void SparseDelegateReport (const TArray< FString > &, UWorld *, FOutputDevice &)
 

Friends

struct FObjectListener
 

Detailed Description

Sparse delegates can be used for infrequently bound dynamic delegates so that the object uses only 1 byte of storage instead of having the full overhead of the delegate invocation list. The cost to invoke, add, remove, etc. from the delegate is higher than using the delegate directly and thus the memory savings benefit should be traded off against the frequency with which you would expect the delegate to be bound. Helper class for handling sparse delegate bindings

Member Function Documentation

◆ Add()

bool FSparseDelegateStorage::Add ( const UObject DelegateOwner,
const FName  DelegateName,
FScriptDelegate  Delegate 
)
static

Binds a sparse delegate to the owner. Returns if the delegate was successfully bound.

◆ AddUnique()

bool FSparseDelegateStorage::AddUnique ( const UObject DelegateOwner,
const FName  DelegateName,
FScriptDelegate  Delegate 
)
static

Binds a sparse delegate to the owner, verifying first that the delegate is not already bound. Returns if the delegate was successfully bound.

◆ Clear()

void FSparseDelegateStorage::Clear ( const UObject DelegateOwner,
const FName  DelegateName 
)
static

Clear all of the named sparse delegate bindings from the owner.

◆ Contains() [1/2]

bool FSparseDelegateStorage::Contains ( const UObject DelegateOwner,
const FName  DelegateName,
const FScriptDelegate Delegate 
)
static

Returns whether a sparse delegate is bound to the owner.

◆ Contains() [2/2]

bool FSparseDelegateStorage::Contains ( const UObject DelegateOwner,
const FName  DelegateName,
const UObject InObject,
FName  InFunctionName 
)
static

◆ GetMulticastDelegate()

FMulticastScriptDelegate * FSparseDelegateStorage::GetMulticastDelegate ( const UObject DelegateOwner,
const FName  DelegateName 
)
static

Acquires the actual Multicast Delegate from the annotation if any delegates are bound to it. Will be null if no entry exists in the annotation for this object/delegatename.

◆ GetSharedMulticastDelegate()

TSharedPtr< FMulticastScriptDelegate > FSparseDelegateStorage::GetSharedMulticastDelegate ( const UObject DelegateOwner,
const FName  DelegateName 
)
static

Acquires the actual Multicast Delegate from the annotation if any delegates are bound to it as a shared pointer. Will be null if no entry exists in the annotation for this object/delegatename.

◆ RegisterDelegateOffset()

void FSparseDelegateStorage::RegisterDelegateOffset ( const UObject OwningObject,
FName  DelegateName,
size_t  OffsetToOwner 
)
static

Registers the sparse delegate so that the offset can be determined.

◆ Remove() [1/2]

bool FSparseDelegateStorage::Remove ( const UObject DelegateOwner,
const FName  DelegateName,
const FScriptDelegate Delegate 
)
static

Removes a delegate binding from the owner's sparse delegate storage. Returns true if there are still bindings to the delegate.

◆ Remove() [2/2]

bool FSparseDelegateStorage::Remove ( const UObject DelegateOwner,
const FName  DelegateName,
const UObject InObject,
FName  InFunctionName 
)
static

◆ RemoveAll()

bool FSparseDelegateStorage::RemoveAll ( const UObject DelegateOwner,
const FName  DelegateName,
const UObject UserObject 
)
static

Removes all sparse delegate binding from the owner for a given object. Returns true if there are still bindings to the delegate.

◆ ResolveSparseDelegate()

FSparseDelegate * FSparseDelegateStorage::ResolveSparseDelegate ( const UObject OwningObject,
FName  DelegateName 
)
static

Using the registry of sparse delegates recover the FSparseDelegate address from the UObject and name.

◆ ResolveSparseOwner()

UObject * FSparseDelegateStorage::ResolveSparseOwner ( const FSparseDelegate SparseDelegate,
const FName  OwningClassName,
const FName  DelegateName 
)
static

Using the registry of sparse delegates recover the UObject owner from the FSparseDelegate address owning class and delegate names.

◆ SetMulticastDelegate()

void FSparseDelegateStorage::SetMulticastDelegate ( const UObject DelegateOwner,
const FName  DelegateName,
FMulticastScriptDelegate  Delegate 
)
static

Directly sets the Multicast Delegate for this object/delegatename pair. If the delegate is unbound it will be assigned/inserted anyways.

◆ SparseDelegateReport()

void FSparseDelegateStorage::SparseDelegateReport ( const TArray< FString > &  Args,
UWorld ,
FOutputDevice Ar 
)
static

Outputs a report about which delegates are bound.

Friends And Related Symbol Documentation

◆ FObjectListener

friend struct FObjectListener
friend

Allow the object listener to use the critical section and remove objects from the map


The documentation for this struct was generated from the following files: