Hi everyone,
I am having a problem with a property that is set to null after constructor finishes. I have a variable of UAttributeSet in my character and it is created in my constructor. This is the code:
AEdenValleyCharacterBase::AEdenValleyCharacterBase()
{
PrimaryActorTick.bCanEverTick = true;
GetCapsuleComponent()->InitCapsuleSize(45.0f, 96.0f);
AbilitySystemComp = CreateDefaultSubobject<UAbilitySystemComponent>(TEXT("AbilitySystemComponent"));
AbilitySystemComp->SetIsReplicated(true);
AttributeSet = CreateDefaultSubobject<UEdenValleyAttributeSet>(TEXT("AttributeSet"));
CharacterLevel = 1;
bAbilitiesInitilized = false;
bBlockAbilities = false;
}
After finishing this part of the code, AttributeSet
is set to null. This variable is exposed to UPROPERTY
so GC wouldn’t delete this variable. Also, AbilitySystemComp
is declared as AttributeSet
. But, for any reason, only AttributeSet
is null.
Thanks in advance.