Trying to understand whats needed to get default starting data setup for GAS component attribute set. i followed the tutorial below using the tutorial code as example.
v=YvXvWa6vbAA&t=9814s
I have created attribute class and setup data table with my attribute set inside the character’s GAS component in BP under the attribute test section.
I have created the GAS component inside characters constructor
In characters beginplay i have called GetSet on the GAS component to initialise the pointer to attributes.
And in my characters tick, i have function that periodically logs the value of the attributes and its all showing zero. not matching the values in my data table.
Its just a simple experiment to confirm that attributes are initialised with data from datatable.
my question is, am i , missing any crucial steps here
on another note struggling to post this question
UNreal engine please make the version tag thing more intuitive for making posts struggling to post due to version tag not added and i have no idea what version its asking for i only know of ue4 and ue5
stop putting blockers that require expert knowledge to making posts to ask questions.
Happy to help, but I’m not going to watch a 3-hour video to guess what your code might look like/is supposed to look like.
It sounds like your problem is that the attribute values are not getting set properly. And it vaguely sounds like you are storing the desired values in a data table, but for some reason the attributes are not getting initialized to those values. Please show us the code that sets the attribute values to the values in the data table, and then maybe we can help troubleshoot what’s wrong with that code.
AC_GasCharacterBase::AC_GasCharacterBase()
{
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
mvo_pGasComp = CreateDefaultSubobject<UAbilitySystemComponent>(TEXT("CharGasComponent"));
}
// Called when the game starts or when spawned
void AC_GasCharacterBase::BeginPlay()
{
Super::BeginPlay();
//Initializes the attribute set using a data table.
verifyf(IsValid(mvo_pGasComp), TEXT("Invalid gas comp"));
//initlaise attribute pointer, hopefully this should be populated with data from my table
mvo_pCharAttrSpec = mvo_pGasComp->GetSet<UC_CharAttributeSet>();
verifyf(IsValid(mvo_pCharAttrSpec), TEXT("Invalid gas attributes"));
}
// Called every frame
void AC_GasCharacterBase::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
mfo_DisplayAttributes();
}
found the problem in the bit that prints out the attribute values inside tick, i was using %d as print format, but using %f shows exactly what i have in the table.
I could be wrong , but atleast using %d you should still get the integer of the float without decimal points, but here it just shows zero if the value is a float and format is %d.