お世話になっております。
アクター同期時のクライアント側の挙動について気になったところがありましたので確認のため質問させて頂きます。
PackageMapClient.cppのSerializeNewActor()関数内は下記クライアント側のアクターを生成するコードがあります(476行目あたり):
// Spawn actor if necessary (we may have already found it if it was dormant)
if ( Actor == NULL )
{
if ( Archetype )
{
// For streaming levels, it's possible that the owning level has been made not-visible but is still loaded.
// In that case, the level will still be found but the owning world will be invalid.
// If that happens, wait to spawn the Actor until the next time the level is streamed in.
// At that point, the Server should resend any dynamic Actors.
ULevel* SpawnLevel = Cast(ActorLevel);
if (SpawnLevel == nullptr || SpawnLevel->GetWorld() != nullptr)
{
FActorSpawnParameters SpawnInfo;
SpawnInfo.Template = Cast(Archetype);
SpawnInfo.OverrideLevel = SpawnLevel;
SpawnInfo.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
SpawnInfo.bRemoteOwned = true;
SpawnInfo.bNoFail = true;
UWorld* World = Connection->Driver->GetWorld();
FVector SpawnLocation = FRepMovement::RebaseOntoLocalOrigin(Location, World->OriginLocation);
Actor = World->SpawnActorAbsolute(Archetype->GetClass(), FTransform(Rotation, SpawnLocation), SpawnInfo);
if (Actor)
{
// Velocity was serialized by the server
if (bSerializeVelocity)
{
Actor->PostNetReceiveVelocity(Velocity);
}
// Scale was serialized by the server
if (bSerializeScale)
{
Actor->SetActorScale3D(Scale);
}
GuidCache->RegisterNetGUID_Client(NetGUID, Actor);
bActorWasSpawned = true;
}
World->SpawnActorAbsoluteを呼ぶ際にTransformにScaleを入れていなくて、Spawnした後でScaleだけを再設定するのはなぜでしょうか?
SpawnInfoのbDeferConstructionがデフォルト値のままなのでSpawnActorAbsolute()の中ではBeginPlayが呼ばれません。そのためSetActorScale3D()を呼ばれるタイミングではBeginPlayがまだ呼ばれていませんけど、SetActorScale3D()経由でUpdateOverlap()が呼ばれます。その挙動は正しいのでしょうか?
よろしくお願いいたします。