Description

Calling SetActorLabel causes an actor's components to return to default states when called from a client accessing a listen server outside of main editor process.

Note: User posted code linked to spawn actor on linked URL. Code is located below:

ASpawner::ASpawner()

{ Spawned = nullptr; }

void ASpawner::BeginPlay()
{
Spawned = GetWorld()->SpawnActor<AActor>(SpawnedClass);
for (UActorComponent* MeshActorComponent : Spawned->GetComponentsByClass(UStaticMeshComponent::StaticClass()))

{ UStaticMeshComponent *Mesh = Cast<UStaticMeshComponent>(MeshActorComponent); check(Mesh); Mesh->SetMaterial(0, MaterialToSet); }

PrintMeshMaterials();
Spawned->SetActorLabel(TEXT("Spawned Actor with Label"));
PrintMeshMaterials();
}

void ASpawner::PrintMeshMaterials()
{
for (UActorComponent* MeshActorComponent : Spawned->GetComponentsByClass(UStaticMeshComponent::StaticClass()))

{ UStaticMeshComponent *Mesh = Cast<UStaticMeshComponent>(MeshActorComponent); check(Mesh); UMaterialInterface* Material = Mesh->GetMaterial(0); GEngine->AddOnScreenDebugMessage(-1, 1000.0f, Material == MaterialToSet ? FColor::Green : FColor::Red, Material->GetName()); }

}

Steps to Reproduce

1. Download and unzip attached zip file
2. Open Project in .zip file
3. Go to Play dropdown menu>Advanced settings.
4. Set Number of Players to 2
5. Uncheck Use Single Process
6. Set Editor Multiplayer Mode to Play as Listen Server
7. Press Play

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Cannot Reproduce
ComponentTools
Affects Versions4.7.3
CreatedMar 30, 2015
ResolvedAug 3, 2016
UpdatedJul 14, 2021
View Jira Issue