Skip to content

ArtemIyX/AdvancedAssetUnreal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Advanced Data Asset Plugin for Unreal Engine 5.3

More advanced and convenient Data Asset based on Primary Data Asset with its own Thumbnail Render

Description

This asset has a feature in the form of an overridden ID function.

UAdvancedDataAsset::GetPrimaryAssetId()

The ID is formed as follows: FPrimaryAssetId(FPrimaryAssetType(AssetType), AssetId)

Asset Type

You can set the asset type directly in the C++ constructor:

class YOUR_API UMyAdvancedDataAsset : public UAdvancedDataAsset {
	GENERATED_BODY()
public:
  UMyAdvancedDataAsset();
}
UMyAdvancedDataAsset::UMyAdvancedDataAsset()
{
  AssetType = TEXT("MyAsset");
}

Asset ID

You can set the ID in the asset editor:

AssetId

Asset Manager

Don't forget to add your asset to Asset Manager

AssetManager

Thumbnail renderer

You can select any icon from the project to display. You can also add a short name for the display.

UnrealRender

Tips

Due to ID-Type you can use the following snippet code to load the data asset directly

class YOUR_API UMyAssetManager : public UAssetManager
{
	GENERATED_BODY()

public:

	template <class T>
	T* LoadAsset(FName ID)
	{
		if (const UAdvancedDataAsset* Default = Cast<UAdvancedDataAsset>(T::StaticClass()->GetDefaultObject()))
		{
			const FPrimaryAssetId PrimaryAssetId = FPrimaryAssetId(Default->GetType(), ID);
			const FSoftObjectPath path = GetPrimaryAssetPath(PrimaryAssetId);
			if (T* LoadedItem = Cast<T>(path.TryLoad()))
			{
				return LoadedItem;
			}
		}
		return nullptr;
	}
};

Documentation

Doxygen documentation: GitHubPages

Documentation sources: GitHub