Table of Contents

TAssetBundle Manual

TAssetBundle is a powerful, integrated asset bundle management system.


Requirements

  • Unity Version: 2019.4 or later
  • Supported Platforms: Windows, macOS, iOS, Android, WebGL

Quick Start

Get started with TAssetBundle in 3 steps:

Step 1: Create TAssetBundleManifest

Right-click on a folder containing assets you want to bundle, then select Create > TAssetBundle > TAssetBundleManifest.

create_manifest

Step 2: Configure and Build

  1. Select the created TAssetBundleManifest
  2. Add a composition strategy (e.g., all_together)
  3. Right-click and select Run Composition Strategy
  4. Go to TAssetBundle > Build Asset Bundle menu

build_asset_bundle

Step 3: Load Assets

using UnityEngine;
using TAssetBundle;

public class QuickStartExample : MonoBehaviour
{
    void Start()
    {
        // Load asset by path
        TAssetBundles.LoadAssetAsync<GameObject>("Assets/Prefabs/MyPrefab.prefab")
            .OnComplete += handle =>
            {
                Instantiate(handle.Get());
            };
    }
}

That's it! For development, you can also use Editor Asset mode to skip building.


Table of Contents


Setup & Configuration

TAssetBundleManifest

TAssetBundleManifest defines how assets in a folder are organized into AssetBundles.

Creating a Manifest:

Right-click on a folder > Create > TAssetBundle > TAssetBundleManifest

create_manifest

Manifest Options:

tassetbundle_manifest

# Option Description
1 Enabled Include in AssetBundle build target
2 Built-in Include AssetBundles in the app
3 Encrypt Encrypt the configured AssetBundles
4 Tags Set tags for download filtering
5 Composition Strategies List of strategies to auto-configure bundles
6 Asset Bundle Build List Configured AssetBundle information

Manual Configuration:

You can manually add assets by clicking Add Asset Bundle Build Info and dragging assets.

add_assetbundle_build_info

drag_and_drop_assets

Auto Configuration:

Use composition strategies for automatic configuration. Add a strategy, then right-click the manifest and select Run Composition Strategy.

add_composition_strategy

select_composition_strategy

run_composition_strategy


Composition Strategies

Composition strategies automatically configure how assets are grouped into AssetBundles.

default_composition_strategy

Strategy Description
all_separately Add assets as individual asset bundles
all_together Add assets as one asset bundle
clear Clear asset bundle build information
exclude_objects Exclude specific assets from build info
file_separately Add only files as individual asset bundles
file_together Add only files as one asset bundle
fixed_objects Add only specific assets to one asset bundle
folder_separately Add only folders as individual asset bundles
folder_together Add only folders as one asset bundle
regex_match Add assets matching regex to one asset bundle
regex_match_delete Remove build info if filename matches regex
regex_not_match_delete Remove build info if filename doesn't match regex
same_name_together Add assets with same filename as one asset bundle

TAssetBundle Settings

Access via TAssetBundle > Settings menu.

tassetbundle_settings

# Setting Description
1 Catalog Name Name of the catalog file
2 Output Folder AssetBundle build output folder
3 Catalog Extension Catalog file extension
4 Bundle Extension AssetBundle file extension
5 Compress Catalog Enable catalog compression
6 Encrypt Catalog Enable catalog encryption
7 Encryption Key Key for encryption
8 Append Hash Add hash to asset bundle filename
9 Editor Play Mode Asset loading mode in editor
10 Force Remote Only Force remote AssetBundles in editor
11 Max Concurrent Requests Maximum concurrent web requests
12 Max Retry Count Maximum web request retries
13 Retry Wait Duration Wait time between retries
14 Use Build Cache Only build changed AssetBundles
15 Debug Log Enable debug logging
16 Include Catalog Include catalog in app
17 Embed Method How to embed AssetBundles
18 Recompress to LZ4 Recompress built-in bundles to LZ4
19 Use Unity Provider Use UnityRemoteAssetBundleProvider
20 Custom Catalog Serializer Custom catalog serializer
21 Custom Crypto Serializer Custom crypto serializer
22 Default Remote URL Default remote download URL

Building Asset Bundles

After configuring your manifests, build AssetBundles via TAssetBundle > Build Asset Bundle menu.

build_asset_bundle

Build Features:

  • Incremental Build: Only changed assets are rebuilt (when Build Cache is enabled)
  • Automatic Dependency Management: Dependencies between bundles are handled automatically
  • Cross-Platform: Build for any supported platform

Loading Assets

TAssetBundle provides multiple ways to load assets.

Using Asset Path

Load assets using their project path. The path must be updated if the asset is moved.

Getting the asset path:

get_asset_path

using UnityEngine;
using TAssetBundle;

public class TestLoadAsset : MonoBehaviour
{
    public string prefabPath; // Asset Path

    void Awake()
    {
        var loadAsset = TAssetBundles.LoadAssetAsync<GameObject>(prefabPath);
        loadAsset.OnComplete += (AssetHandle<GameObject> assetHandle) =>
        {
            var asset = assetHandle.Get();
            Instantiate(asset);
        };
    }

    void OnDestroy()
    {
        TAssetBundles.UnloadAsset(prefabPath);
    }
}

Using Asset Reference

Asset references allow drag-and-drop in the inspector and remain valid even if the asset is moved.

drag_and_drop_asset

using UnityEngine;
using TAssetBundle;

public class TestLoadAssetReference : MonoBehaviour
{
    [AssetType(typeof(GameObject))]
    public AssetRef prefab;

    private AssetHandle prefabHandle;

    void Awake()
    {
        var loadAsset = TAssetBundles.LoadAssetAsync<GameObject>(prefab);
        loadAsset.OnComplete += (AssetHandle<GameObject> assetHandle) =>
        {
            prefabHandle = assetHandle;
            var asset = assetHandle.Get();
            Instantiate(asset);
        };
    }

    void OnDestroy()
    {
        TAssetBundles.UnloadAsset(prefabHandle);
    }
}

Using AssetManager

AssetManager (in TAssetBundle.Extensions) provides advanced asset management with automatic tracking and pooling.

Loading Assets with Auto-Unload:

using UnityEngine;
using TAssetBundle;
using TAssetBundle.Extensions;

public class TestAssetManagerLoadAsset : MonoBehaviour
{
    public Image imageManualLink;
    public Image imageAutoLink;
    public string spritePath;

    private void Start()
    {
        // Manual linking
        AssetManager.LoadAssetAsync<Sprite>(spritePath).OnCompleted += asset =>
        {
            imageManualLink.sprite = asset.Get();
            imageManualLink.LinkAsset(asset); // Link for auto-tracking
        };

        // Auto linking (recommended)
        AssetManager.LoadAssetAsync<Sprite>(imageAutoLink.gameObject, spritePath).OnCompleted += asset =>
        {
            imageAutoLink.sprite = asset.Get();
        };
    }

    private void OnGUI()
    {
        if (GUILayout.Button("Unload Unused Assets"))
        {
            AssetManager.UnloadUnusedAssets();
        }
    }
}

Prefab Instantiation with Pooling:

using UnityEngine;
using TAssetBundle;
using TAssetBundle.Extensions;

public class TestAssetManagerGetPrefab : MonoBehaviour
{
    public GameObjectAssetRef prefab;

    private void Start()
    {
        AssetManager.GetPrefabAsync(prefab, transform).OnCompleted += go =>
        {
            go.name = prefab.Path;
        };
    }
}

Remote Download

Download AssetBundles from a remote server.

Download Flow:

  1. Check for Catalog Update
  2. Update the Catalog
  3. Get the Download Size
  4. Download the Assets
using UnityEngine;
using UnityEngine.UI;
using TAssetBundle;

public class RemoteDownloadExample : MonoBehaviour
{
    public string remoteDownloadUrl;
    public Text statusText;

    private void Awake()
    {
        // [BuildTarget] is replaced with actual platform
        TAssetBundles.SetRemoteUrl(remoteDownloadUrl);
    }

    private void OnGUI()
    {
        if (GUILayout.Button("Check Catalog Update"))
        {
            TAssetBundles.CheckCatalogUpdateAsync().OnComplete += result =>
            {
                statusText.text = "Need update: " + result;
            };
        }

        if (GUILayout.Button("Update Catalog"))
        {
            TAssetBundles.UpdateCatalogAsync().OnComplete += result =>
            {
                statusText.text = "Update result: " + result;
            };
        }

        if (GUILayout.Button("Get Download Size"))
        {
            TAssetBundles.GetDownloadSizeAsync().OnComplete += size =>
            {
                statusText.text = "Size: " + FileSizeFormatter.FormatSize(size);
            };
        }

        if (GUILayout.Button("Download All"))
        {
            var download = TAssetBundles.DownloadAsync();
            download.OnProgress += info =>
            {
                double percent = info.DownloadedSize / (double)info.TotalDownloadSize * 100;
                statusText.text = $"Downloading: {percent:0.0}%";
            };
            download.OnComplete += info =>
            {
                statusText.text = info.IsDownloadComplete() ? "Complete!" : "Failed";
            };
        }
    }
}

Download by Tags:

// Get size for specific tags
TAssetBundles.GetDownloadSizeByTagsAsync(new[] { "character", "level1" });

// Download specific tags
TAssetBundles.DownloadByTagsAsync(new[] { "character" });

Download by Assets:

// Download specific assets
TAssetBundles.DownloadByAssetsAsync(new AssetRef[] { myAssetRef });

Editor Tools

TAssetBundle Browser

A unified view of all manifests and bundles. Access via TAssetBundle > TAssetBundle Browser.

tassetbundle_browser

Features:

  • Search: Filter manifests by name, or search assets across all manifests
  • Sort: Sort by Name, Bundle Count, or Asset Count
  • Show Options: Toggle included, not included, or ignored assets

Toolbar Actions:

Button Description
Clear All Asset Bundle Build Infos Remove all bundle configurations
Run All Composition Strategy Execute strategies on all manifests
Build Asset Bundle Build all configured bundles
Check Dependencies Analyze bundle dependencies

TAssetBundle Menu

tassetbundle_menu

# Menu Item Description
1 Settings Open TAssetBundle Settings
2 Clear Build Cache Remove build cache for current platform
3 Build Asset Bundle Build AssetBundles
4 Run All Composition Strategy Run strategies on all manifests
5 Clear All Composition Strategy Clear all manifest build info
6 Open Build Folder Open build output folder
7 Open Cache Folder Open downloaded assets cache folder
8 Clear Cached Assets Remove downloaded asset cache
9 TAssetBundle Browser Open browser window
10 Tag Editor Open tag editor
11 Web Server Test Open web server test window
12 Dependency Checker Check AssetBundle dependencies
13 Asset Reference Tracker Track active assets at runtime

Asset Usage Tracker

Track which GameObjects are using which assets during play mode.

Access via TAssetBundle > Extensions > Asset Usage Tracker.

asset_usage_tracker

Features:

  • View objects currently using assets
  • Sort and filter with regex
  • Debug memory usage

Editor Play Modes

TAssetBundle supports two play modes in the editor:

Editor Asset Mode (Development)

Load assets directly without building AssetBundles. Fast iteration during development.

  1. Go to TAssetBundle > Settings
  2. Set Editor Play Mode to Editor Asset

editor_asset_mode

Asset Bundle Mode (Testing)

Load assets from built AssetBundles. Test production behavior.

  1. Build your AssetBundles first
  2. Go to TAssetBundle > Settings
  3. Set Editor Play Mode to Asset Bundle

setting_playmode_assetbundle