Hello, this may sounds very weird.
But I’m making of Battle Encounter System.
When character’s attack is successful in OnField Level,
then calls Seamless Travel from OnField GameMode
to enter InBattle Level.
So it needs PlayerState to transfer OnField Level to InBattle Level.
And i’m also making of 4 Characters Party System, so the information of the party is in Player State as well.
(use cases of how many, and which character is in the party or etc)
protected:
// Copy Properties for Seamless Travel
virtual void CopyProperties(APlayerState* NewPlayerState) override;
protected:
UPROPERTY(Replicated)
TArray<APawn*> PlayerParty;
void ARBPlayerState::CopyProperties(APlayerState* NewPlayerState)
{
Super::CopyProperties(NewPlayerState);
UE_LOG(LogTemp, Warning, TEXT("Copy Properties in New PlayerState"));
if (ARBPlayerState* NPS = Cast<ARBPlayerState>(NewPlayerState))
{
NPS->SetPlayerParty(PlayerParty);
}
}
It calls Copy Properties in InBattle Level very well,
but the original data of PlayerParty seems to be broken before Copy Properties.
<< PlayerParty data in PlayerState (before Travel, in OnField Level) >>
<< PlayerParty data in Old PlayerState (right after Travel, in the middle of CopyProperties >>
So, eventually new Player State can’t copy properties at all. The original data seems to be gone before Copy Properties.
But the Very weird part is,
that the ‘Value’ members just work fine.
protected:
UPROPERTY(Replicated)
TArray<APawn*> PlayerParty;
public:
UPROPERTY(Replicated)
int32 TestMember = 0;
When i tested with integer member (TestMember), it just copies very well like below :
Why the 'reference' data has gone before CopyProperties ?
Player State doesn't allow referenced data because it removed from world after traveled ?
Then where i should place PlayerParty variable?
Thanks for your help.