UActorComponent::GetAssetUserDataOfClass
#include "Components/ActorComponent.h"
Access: public
Specifiers: virtualoverride
Description
Returns the `UAssetUserData` instance of the specified class attached to this component, or null if none exists.
Caveats & Gotchas
- • Returns null if no data of that exact class has been added — always null-check the result before use.
- • Lookup is by exact class; a subclass instance registered under a parent class type will not be returned when querying by the parent class.
Signature
ENGINE_API virtual UAssetUserData* GetAssetUserDataOfClass(TSubclassOf<UAssetUserData> InUserDataClass) override; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InUserDataClass | TSubclassOf<UAssetUserData> | The class of user data to retrieve. | — |
Return Type
UAssetUserData* Example
Retrieve and use plugin-specific component data C++
if (UMyPluginData* Data = Cast<UMyPluginData>(MyComponent->GetAssetUserDataOfClass(UMyPluginData::StaticClass())))
{
UE_LOG(LogTemp, Log, TEXT("Plugin custom value: %d"), Data->CustomValue);
} See Also
Tags
Version History
Introduced in: 4.14
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?