If
deep is
false, a
shallow copy is returned: nested
Array,
Dictionary, and
Resource properties are not duplicated and are shared with the original resource.
If
deep is
true, a
deep copy is returned: all nested arrays, dictionaries, and packed arrays are also duplicated (recursively). Any
Resource found inside will only be duplicated if it's local, like
DEEP_DUPLICATE_INTERNAL used with
duplicate_deep.
The following exceptions apply:
- Subresource properties with the
PROPERTY_USAGE_ALWAYS_DUPLICATE flag are always duplicated (recursively or not, depending on
deep).
- Subresource properties with the
PROPERTY_USAGE_NEVER_DUPLICATE flag are never duplicated.
Note: For custom resources, this method will fail if [method Object._init] has been defined with required parameters.
Note: When duplicating with
deep set to
true, each resource found, including the one on which this method is called, will be only duplicated once and referenced as many times as needed in the duplicate. For instance, if you are duplicating resource A that happens to have resource B referenced twice, you'll get a new resource A' referencing a new resource B' twice.