TakesUtils::CreateNewAssetPackage

Creates a new Package with the given Package Name (ie: /Game/Test/Foo) of the specified AssetType.

Windows
MacOS
Linux

References

Module

TakesCore

Header

/Engine/Plugins/VirtualProduction/Takes/Source/TakesCore/Public/TakesUtils.h

Include

#include "TakesUtils.h"

Syntax

namespace TakesUtils
{
    template<typename AssetType>
    static bool TakesUtils::CreateNewAssetPackage
    (
        FString & InPackageName,
        AssetType *& OutAsset,
        FText * OutError,
        AssetType * OptionalBase
    )
}

Remarks

Creates a new Package with the given Package Name (ie: /Game/Test/Foo) of the specified AssetType. If a package already exists at that name the package name will have a number appended and iterated on until an unused package name is found. InPackageName will be modified in this case and will return the package name that the asset was actually created at.

You should consider calling MarkPackageDirty() on the returned asset if you further modify it, and you shouldstill notify the FAssetRegistryModule that the asset was created after this by calling FAssetRegistryModule::AssetCreated

Returns

True if the asset was created successfully, false if there was an error.

Parameters

Parameter

Description

InPackageName

The desired package name (path and asset name) for the new asset. May be mutated by this function if that package name is already taken.

OutAsset

The resulting asset if we were able to successfully create an asset.

OutError

Human readable error string to describe what went wrong (if anything). Can be nullptr if you don't care about the error message.

OptionalBase

Optional asset reference to duplicate the new asset from. If nullptr a brand new asset will be created.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss