UAttributeSet::ShouldInitProperty
#include "AttributeSet.h"
Access: public
Specifiers: virtualconst
Description
Override to opt specific properties out of the default initialization pass an AttributeSet runs when it's constructed or reset.
Caveats & Gotchas
- • Default implementation returns true for every property, so overriding is opt-in and only needed when you want to skip specific attributes.
- • Called for every reflected property during init, not just FGameplayAttributeData ones, so check PropertyToInit before rejecting anything.
Signature
virtual bool ShouldInitProperty(bool FirstInit, FProperty* PropertyToInit) const { return true; } Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| FirstInit | bool | True if this is the very first initialization pass for the attribute set. | — |
| PropertyToInit | FProperty* | The property about to be initialized. | — |
Return Type
bool Example
Skip re-initializing MaxHealth after first init C++
bool UMyAttributeSet::ShouldInitProperty(bool FirstInit, FProperty* PropertyToInit) const
{
if (PropertyToInit->GetFName() == GET_MEMBER_NAME_CHECKED(UMyAttributeSet, MaxHealth))
{
return FirstInit;
}
return true;
} See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?