sourceTable | The source table whose contents will be merged into this table. |
Merges all asset entries and their metadata from another InstantAssetTable into this table.
This operation adds new assets and overwrites existing entries with those from the source table. Commonly used to combine multiple asset tables or update this table with additional assets.
using UnityEngine; using System.IO;
public class MergeExample : MonoBehaviour { public InstantAssetTable mainTable; public string sourceTablePath = "Assets/StreamingAssets/additional_assets"; void Start() { // Load another asset table InstantAssetTable sourceTable = InstantAsset.ReadAssetTable(sourceTablePath) as InstantAssetTable; if (sourceTable != null) { // Merge source table into main table mainTable.MergeFrom(sourceTable); Debug.Log("Tables merged successfully!"); Debug.Log($"Main table now contains {mainTable.GetAllAssetsPath().Length} assets"); // Clean up InstantAsset.UnloadAssetTable(sourceTable); } else { Debug.LogError("Failed to load source asset table"); } } }