Hello,
I’m having a lot of trouble getting the behavior I want. What ends up happening is an abort gets triggered instead.
Here is the the last non assembly line called
UWorld(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());
Which gets called by APSAbility
when the following code is called in PSCharacter
if (PrimAug != nullptr)
{
PrimAug->OnUse();
}
And here is where I get the pointer to PrimAug in PSCharacter::PostInitializeComponents()
if (PrimAugClass != NULL)
{
FActorSpawnParameters SpawnParameters = FActorSpawnParameters();
SpawnParameters.bAllowDuringConstructionScript = true;
SpawnParameters.bNoFail = true;
SpawnParameters.Instigator = Instigator;
SpawnParameters.Name = TEXT("PrimaryAugmentation");
SpawnParameters.Owner = this;
SpawnParameters.Template = NULL;
PrimAug = GetWorld()->SpawnActor<APSAbility>( PrimAugClass
, SpawnParameters
);
}
The signature for APSAbility’s constructor
APSAbility::APSAbility()
: CDDuration(10.f)
, bOnCD(false)
{}
And the relevant data members of PSCharacter:
/** AugmentationOne class */
UPROPERTY(EditDefaultsOnly, Category=Abilities)
TSubclassOf<class APSAbility> PrimAugClass;
class APSAbility* PrimAug;
The idea is I in different BP instance of PSChar I will set different classes which implement different abilities, but use the
APSAbility::OnUse()
As a common interface to call the abilities.
If you need any more info please let me know. I’d really like to get this working.
Thanks,