Description

A user has reported that when an actor blueprint enables Generate Optimized Component Blueprint Data, default instanced objects of components are not properly duplicated in cooked builds. This results in the actor instance pointing to the template of instanced objects.

In a cooked build, instanced objects on the blueprint class should be duplicated via a callstack like this:

 

OptimizedComp532R.exe!UInstanceableObject::UInstanceableObject() [Z:\BugRepro2024\OptimizedComp532R\Source\OptimizedComp532R\SubobjectReproActor.cpp:19]
OptimizedComp532R.exe!StaticConstructObject_Internal() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:4561]
OptimizedComp532R.exe!FDuplicateDataWriter::GetDuplicatedObject() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\Serialization\DuplicateDataWriter.cpp:177]
OptimizedComp532R.exe!FDuplicateDataWriter::operator<<() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\Serialization\DuplicateDataWriter.cpp:72]
OptimizedComp532R.exe!FObjectProperty::SerializeItem() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\UObject\PropertyObject.cpp:239]
OptimizedComp532R.exe!SerializeUnversionedProperties() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\Serialization\UnversionedPropertySerialization.cpp:1008]
OptimizedComp532R.exe!UStruct::SerializeTaggedProperties() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:1444]
OptimizedComp532R.exe!UObject::SerializeScriptProperties() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1905]
OptimizedComp532R.exe!UObject::Serialize() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1705]
OptimizedComp532R.exe!UObject::Serialize() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\UObject\Obj.cpp:1556]
OptimizedComp532R.exe!UActorComponent::Serialize() [Z:\UE\Engine\Source\Runtime\Engine\Private\Components\ActorComponent.cpp:2582]
OptimizedComp532R.exe!USceneComponent::Serialize() [Z:\UE\Engine\Source\Runtime\Engine\Private\Components\SceneComponent.cpp:3585]
OptimizedComp532R.exe!StaticDuplicateObjectEx() [Z:\UE\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp:3160]
OptimizedComp532R.exe!AActor::CreateComponentFromTemplate() [Z:\UE\Engine\Source\Runtime\Engine\Private\ActorConstruction.cpp:1099]
OptimizedComp532R.exe!USCS_Node::ExecuteNodeOnActor() [Z:\UE\Engine\Source\Runtime\Engine\Private\SCS_Node.cpp:104]
OptimizedComp532R.exe!USimpleConstructionScript::ExecuteScriptOnActor() [Z:\UE\Engine\Source\Runtime\Engine\Private\SimpleConstructionScript.cpp:647]
OptimizedComp532R.exe!AActor::ExecuteConstruction() [Z:\UE\Engine\Source\Runtime\Engine\Private\ActorConstruction.cpp:871]
OptimizedComp532R.exe!AActor::FinishSpawning() [Z:\UE\Engine\Source\Runtime\Engine\Private\Actor.cpp:3964]
OptimizedComp532R.exe!UGameplayStatics::FinishSpawningActor() [Z:\UE\Engine\Source\Runtime\Engine\Private\GameplayStatics.cpp:896] 

This call is absent for actor blueprints with Generate Optimized Component Blueprint Data enabled.

 

Steps to Reproduce

Internal minimal repro project attached.

Repro steps from clean project:

  • Create the following actor, component and property hierarchy:
  • (BP) BP_SomeActorClass
    • (SCS) MySceneComponent that has a
      • UPROPERTY(Instanced)
        UMyObject* MyObject;
  • In the actor blueprint enable the default setting Generate Optimized Component Blueprint Data. Native: bOptimizeBPComponentData
  • Assign MyObject some value in the actor blueprint.
  • Have MySceneComponent's class print MyObject's path name and BeginPlay.
  • Spawn the actor class at runtime with a debug key
  • Make a cooked build with this setup
  • Observe: In cooked builds, the runtime spawned actor's MyObject will point to the archetype rather than being a duplicated instance for the actor instance.
  • Expected: The spawned actor has a duplicate instance of MyObject

Have Comments or More Details?

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

0
Login to Vote

Unresolved
ComponentUE - Gameplay - Blueprint Runtime
Affects Versions5.3.25.4.4
Target Fix5.6
CreatedAug 29, 2024
UpdatedSep 6, 2024
View Jira Issue