Problem solved: The reason might be the timing of the class creation. The breakpoint was triggered as soon as UE started, which made me realize that the value might have been assigned before this point. So, I moved it to BeginPlay, and it was successfully assigned.
void ADianTi_Body::BeginPlay()
{
Super::BeginPlay();
CurrentLocation = GetRootComponent()->GetComponentLocation();
YuanLocation = CurrentLocation;
TargetLocation = FVector(YuanLocation.X, YuanLocation.Y, YuanLocation.Z + 300.f);
}
![]()