Skip to main content
Version: v3

YooAssetBridge

Important Attention Reminder

Coding Style wiki


YooAssetBridge is the bridge from AssetLoader to YooAsset. It uses reflection to access YooAsset internal members, allowing the framework to obtain the necessary information without modifying the YooAsset package source code. It is organized into three nested static classes by bridging target: YooAssetSettingsData, DownloadSystemHelper, and DefaultBuildinFileSystemDefine.

NamespaceOxGFrame.AssetLoader.Bundle
Typepublic static class
SourceYooAssetBridge.cs
using OxGFrame.AssetLoader.Bundle;

Important YooAssetBridge relies heavily on reflection. If a future YooAsset version changes its internal class, property, or field names, this bridge will be maintained accordingly.

YooAssetBridge.YooAssetSettingsData

Bridges YooAsset's global settings data (YooAssetSettingsData).

Method Overview

MethodDescription
GetPackageManifestPrefixGets the manifest file prefix (PackageManifestPrefix).
GetYooDefaultCacheRootGets YooAsset's default cache file root directory (sandbox).
GetYooDefaultBuildinRootGets YooAsset's default built-in file root directory (StreamingAssets).

GetPackageManifestPrefix

public static string GetPackageManifestPrefix()

Returns

string — the manifest file prefix.

Description

Reads the PackageManifestPrefix field from YooAsset's settings (YooAssetSettingsData.Setting) via reflection — the prefix name of asset manifest files.


GetYooDefaultCacheRoot

public static string GetYooDefaultCacheRoot()

Returns

string — YooAsset's default cache file root directory path.

Description

Invokes YooAsset's internal GetYooDefaultCacheRoot method via reflection to get the default cache file root directory (sandbox — the local persistent download storage).

Reminder BundleConfig.GetLocalSandboxRootPath obtains its root directory through this method.

Example

// Get the local cache root directory (sandbox)
string cacheRoot = YooAssetBridge.YooAssetSettingsData.GetYooDefaultCacheRoot();

GetYooDefaultBuildinRoot

public static string GetYooDefaultBuildinRoot()

Returns

string — YooAsset's default built-in file root directory path.

Description

Invokes YooAsset's internal GetYooDefaultBuildinRoot method via reflection to get the default built-in file root directory (under StreamingAssets).

Reminder BundleConfig.GetBuiltinRootPath obtains its root directory through this method.


YooAssetBridge.DownloadSystemHelper

Bridges YooAsset's download system helper (DownloadSystemHelper) for path conversion.

Method Overview

MethodDescription
ConvertToWWWPathConverts a local path into a WWW / UnityWebRequest loadable path.

ConvertToWWWPath

public static string ConvertToWWWPath(string path)

Parameters

ParameterTypeDescription
pathstringOriginal local path.

Returns

string — the converted load path.

Description

Invokes YooAsset's internal DownloadSystemHelper.ConvertToWWWPath method via reflection to convert a regular local path into a format suitable for UnityWebRequest (WWW) loading.

Attention This method automatically handles the file protocol prefix (e.g., file://) based on the runtime platform.

Example

// Convert the StreamingAssets path into a UnityWebRequest-compatible format
string wwwPath = YooAssetBridge.DownloadSystemHelper.ConvertToWWWPath(Application.streamingAssetsPath);

YooAssetBridge.DefaultBuildinFileSystemDefine

Bridges the defines of YooAsset's built-in file system (DefaultBuildinFileSystemDefine).

Method Overview

MethodDescription
BuildinCatalogBinaryFileNameGets the binary file name of the built-in asset catalog.

BuildinCatalogBinaryFileName

public static string BuildinCatalogBinaryFileName()

Returns

string — the binary file name of the built-in asset catalog.

Description

Reads the value of YooAsset's internal DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName field via reflection — the file name of the built-in asset catalog (catalog binary file).