Download

Is there a simple way to get class variable values without spawning actor

This is my current setup to getting current blueprint variable values from class. Is there a
way to do this but without spawning an actor to get the variable value? i feel there
is a much more simpler/efficient way to do this.


FActorSpawnParameters SpawnParams;
SpawnParams.Owner = this;
SpawnParams.Instigator = Instigator;
FTransform TempTransform;
 
AActor* const TempSpawnObject = GetWorld()->SpawnActor<AActor>(MyBlueprintClass, TempTransform.GetLocation(), TempTransform.GetRotation().Rotator(), SpawnParams);
 
if (TempSpawnObject)
{
        ACustomActor* const CustAct = Cast<ACustomActor>(TempSpawnObject);
 
        if(CustAct)
        {
                CustAct->ReadCustomVariableValue
        }
        TempSpawnObject->Destroy();
}

I am currently on my system but there is a function like


ACustomActor->GetDefaultObject()

or something similar.

Yeah, just found that out from the answer hub and it works :smiley: Thanks for helping.