| sourceTable | The source table containing assets to be removed from this table. |
Removes all asset entries and their metadata that exist in another InstantAssetTable from this table.
This operation effectively filters out assets that are present in the source table, leaving only unique entries. Useful for creating differential asset tables or removing specific assets.
using UnityEngine; using System.IO;
public class SubtractExample : MonoBehaviour { public InstantAssetTable fullTable; public string baseTablePath = "Assets/StreamingAssets/base_assets"; void Start() { // Load the base asset table InstantAssetTable baseTable = InstantAsset.ReadAssetTable(baseTablePath) as InstantAssetTable; if (baseTable != null) { // Get initial count int initialCount = fullTable.GetAllAssetsPath().Length; // Subtract base table from full table (removes common assets) fullTable.Subtract(baseTable); int finalCount = fullTable.GetAllAssetsPath().Length; Debug.Log($"Subtracted {initialCount - finalCount} common assets"); Debug.Log($"Remaining unique assets: {finalCount}"); // Clean up InstantAsset.UnloadAssetTable(baseTable); } else { Debug.LogError("Failed to load base asset table"); } } }