UE5 Simple Asset Library
  • Intro
  • Available Actions
  • User Settings
  • Tool Config
  • For Python Developers
  • Links
Powered by GitBook
On this page
  • Registering an Asset
  • Unregistering an Asset
  • Get an Asset's Data
  • List the Asset Types
  • List the Categories
  • List the Registered Assets

For Python Developers

This page is for developers to be aware of some key features

This plugin was developed in Unreal Engine 5.2 using a mixture of C++, Blueprints, and Python 3.9.7.

The core logic used by the Asset Library is available in the following module:

from simple_asset_library import commands

Registering an Asset

To register an asset we can use the following code example:

commands.register_asset(
    asset = "/Game/some/asset/path",
    asset_type = "envir",
    category = "flowers",
    display_name = "My Flower Asset"
)

The asset input can be either a string path to the Content Browser asset or an unreal.Object object

This function will take the inputs, apply them as Metadata on the asset in Unreal, and then save the asset.

Unregistering an Asset

To unregister an asset we can use the following code example:

commands.unregister_asset("/Game/some/asset/path")

The asset input can be either a string path to the Content Browser asset or an unreal.Object object

This function will remove the Metadata from the asset and then save the asset

Get an Asset's Data

To get the Asset Library data for a registered asset, we can use:

asset_data = commands.get_asset_library_data_for_asset("/Game/some/asset/path")

The return is a tuple with the following ordered data:

(
    bool, # whether the asset is managed
    "asset type",
    "asset category",
    "asset display name"
)

List the Asset Types

To get a string list of the available asset types we can use the following function:

asset_types = commands.get_available_asset_types(include_all_option=False)

the include_all_option argument controls whether to include an "all" entry by default. This flag is enabled when getting the list to provide the UI

List the Categories

To get a string list of categories for a desired asset type we can use:

asset_types = commands.get_available_asset_categories(
    asset_type = "envir",
    include_all_option = False
)

If the asset_type is not provided this function will return every category found in the project for all asset types

the include_all_option argument controls whether to include an "all" entry by default. This flag is enabled when getting the list to provide the UI

List the Registered Assets

To get an unreal.AssetData list of assets registered in the Asset Library we can use:

assets = commands.get_asset_list(
    asset_type = "envir",
    category = "flowers"
)

Both arguments are optional, if an asset_type is provided it will only get assets of that type, and similarly if a category is provided it will only get assets of that category

This function returns the entries as a list of unreal.AssetData objects

PreviousTool ConfigNextLinks

Last updated 9 months ago