StaticDuplicateObject

Creates a copy of SourceObject using the Outer and Name specified, as well as copies of all objects contained by SourceObject.

Choose your operating system:

Windows

macOS

Linux

Deprecated

  • This version is deprecated in favor of StaticDuplicateObjectEx

References

Module

CoreUObject

Header

/Engine/Source/Runtime/CoreUObject/Public/UObject/UObjectGlobals.h

Include

#include "UObject/UObjectGlobals.h"

Source

/Engine/Source/Runtime/CoreUObject/Private/UObject/UObjectGlobals.cpp

Syntax

UObject * StaticDuplicateObject
(
    UObject const * SourceObject,
    UObject * DestOuter,
    const FName DestName,
    EObjectFlags FlagMask,
    UClass * DestClass,
    EDuplicateMode::Type DuplicateMode,
    EInternalObjectFlags InternalFlagsMask
)

Remarks

Creates a copy of SourceObject using the Outer and Name specified, as well as copies of all objects contained by SourceObject. Any objects referenced by SourceOuter or RootObject and contained by SourceOuter are also copied, maintaining their name relative to SourceOuter. Any references to objects that are duplicated are automatically replaced with the copy of the object.

Returns

The duplicate of SourceObject.

Parameters

Parameter

Description

SourceObject

The object to duplicate

DestOuter

The object to use as the Outer for the copy of SourceObject

DestName

The name to use for the copy of SourceObject, if none it will be autogenerated

FlagMask

A bitmask of EObjectFlags that should be propagated to the object copies. The resulting object copies will only have the object flags specified copied from their source object.

DestClass

Optional class to specify for the destination object. MUST BE SERIALIZATION COMPATIBLE WITH SOURCE OBJECT!!!

InternalFlagsMask

Bitmask of EInternalObjectFlags that should be propagated to the object copies.