Description

To step through the issue, in the -DiffOnly cook add a breakpoint to UChildActorComponent::OnRegister and UChildActorComponent::OnUnregister. It should hit 4 times:

  1. Once when LoadPackage loads the map and serialises the instantiated BP_Spawner instance
  2. Once from the first time we invoke ULevel::IncrementalUpdateComponents before we run the construction scripts. This will early out because the LoadPackage already linked the instanced BP_SpawnedObject instance to the ChildActor property.
  3. Once during the construction script when we instantiate a new ChildActorComponent when we hit the "Add Child Actor Component" node in the Construction Script of BP_Spawner. This will early out because the ChildActorClass is unset when running the construction script.
  4. Once the second time we invoke ULevel::IncrementalUpdateComponents from the second save. This will instantiate a new ChildActor with the same name, but it will not invoke the construction script so the logic to change the sphere's colour (See BP_Spawner construction script) will not be executed. Therefore the colour should remain pink on this second evaluation.

This appears to occur because SetChildActorClass call in the user construction script mutates the ChildActorComponent. When we unregister the component, we don't put the component back into its initial state.

One possible quick fix might be to have CleanupPhysicsSceneThatWasInitializedForSave clear bHasRerunConstructionScripts. However, this might require further digging into the nuances of this component.

Steps to Reproduce
  1. Download, unzip, and build editor for attached project.
  2. Run the editor binary with the arguments "-run=cook -TargetPlatform=Windows -Map="/Game/Levels/TestMap"
  3. Run again with "-run=cook -TargetPlatform=Windows -Map="/Game/Levels/TestMap" -DiffOnly -DiffOutputDir=path\to\output\dir"
  4. Note that DiffOutputDir has diff entries
  5. Expected behavior: no diff entries

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-220376 in the post.

0
Login to Vote

Unresolved
CreatedJul 26, 2024
UpdatedJul 29, 2024
View Jira Issue