x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

SetActorLabel resets components when run outside main editor process

A call to SetActorLabel causes an actor's components to be reset back to default states if you are running the game outside the main editor process.

SetActorLabel calls PostEditChangeProperty, which checks ReregisterComponentsWhenModified(). It looks like this is true when outside the main editor process, causing ReregisterAllComponents and RerunConstructionScripts to reset the actor's components.

This was tricky to debug because I didn't expect SetActorLabel to have such a drastic side-effect and because the problem only happened when running multiple players, making me initially suspect a networking issue.

I am attaching an Unreal project that can be run to reproduce this problem with Unreal 4.7.1.

Unzip and open ReproProject.uproject. Pull down the dropdown next to the Play button, choose Advanced Properties, and set:

 Number of Players: 2
 Use Single Process: Unchecked
 Editor Multiplayer Mode: Play as Listen Server

Then press the play button.

RESULT: Main editor game window has a green block. Second game window has a red block.

EXPECTED: Both windows have green blocks.

Onscreen text shows the material associated with the actor's component and it can be seen that they change when SetActorLabel is called.

Here is the relevant code that spawns the actor, changes its material, and calls SetActorLabel: #include "ReproProject.h" #include "Spawner.h"

 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());
     }
 }
 
Product Version: Not Selected
Tags:
more ▼

asked Mar 29 '15 at 08:23 PM in Bug Reports

avatar image

Forrest.Trepte
1 1 2 5

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi Forrest.Trepte,

I was able to reproduce this on my end and have entered a bug report, UE-13023 to be assessed by the development staff.

more ▼

answered Mar 30 '15 at 08:10 PM

avatar image Forrest.Trepte Mar 30 '15 at 10:24 PM

Thanks! Is there a place where I can track the status of UE-13023 to see when it is resolved?

avatar image Adam Davis STAFF Mar 31 '15 at 03:37 PM

Unfortunately at present we do not have a public bug tracker. For now, keep an eye on the release notes, which can be found in the announcements and releases section of the forums at https://forums.unrealengine.com/ . Each release or hotfix we list what fixes have gone into the engine there!

avatar image cmann Jul 26 '16 at 05:37 PM

Is this still an issues? I seem to be experiencing the same problem in 4.12.5

avatar image Adam Davis STAFF Jul 27 '16 at 08:26 PM

Hi cmann,

We've recently opened a public bug tracker, you can find this specific bug report here: https://issues.unrealengine.com/issue/UE-13023

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question