Question about SpawnActor`s perfomance

hello guys, When I call the function spawnactor to create an blueprint actor, it will eventually call AActor::CreateComponentFromTemplate to create the corresponding component. Here, it will continue to call StaticDuplicateObject to create a new component instance. The invocation of the StaticDuplicateObject function is very resource-consuming, as it performs serialization and deserialization operations. I would like to ask why not call NewObject to create a new component instance instead?

What problems can StaticDuplicateObject solve compared to NewObject?

StaticDuplicateObject is basically NewObject but in addition will copy properties from source (template) to the new object. It is necessary to copy the modifications you applied to its default properties in the Blueprint.

Serialization shouldn’t be too bad if there are not many modified default properties in the blueprint, as it only serializes the delta from default. If you modified lots of defaults props and are doing lots of instancing which results in heavy serialization, consider making a subclass of those heavy components with appropriate defaults and use those subclasses in the blueprint.

Thanks for the reply, if i call NewObject and pass source directly as the template, it will copy properties from source (template) to the new object, So there is no need to call StaticDuplicateObject for serialization, right?