Class ResourcePackage
Assembly: YooAsset.dll
View Source
public class ResourcePackage
Properties
PackageName
包裹名
View Source
public string PackageName { get; }
InitializeStatus
初始化状态
View Source
public EOperationStatus InitializeStatus { get; }
Methods
InitializeAsync(InitializeParameters)
异步初始化
View Source
public InitializationOperation InitializeAsync(InitializeParameters parameters)
Returns
YooAsset.InitializationOperation
Parameters
Type | Name |
---|---|
YooAsset.InitializeParameters | parameters |
UpdatePackageVersionAsync(bool, int)
向网络端请求最新的资源版本
View Source
public UpdatePackageVersionOperation UpdatePackageVersionAsync(bool appendTimeTicks = true, int timeout = 60)
Returns
YooAsset.UpdatePackageVersionOperation
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | appendTimeTicks | 在URL末尾添加时间戳 |
System.Int32 | timeout | 超时时间(默认值:60秒) |
UpdatePackageManifestAsync(string, bool, int)
向网络端请求并更新清单
View Source
public UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion = true, int timeout = 60)
Returns
YooAsset.UpdatePackageManifestOperation
Parameters
Type | Name | Description |
---|---|---|
System.String | packageVersion | 更新的包裹版本 |
System.Boolean | autoSaveVersion | 更新成功后自动保存版本号,作为下次初始化的版本。 |
System.Int32 | timeout | 超时时间(默认值:60秒) |
PreDownloadContentAsync(string, int)
预下载指定版本的包裹资源
View Source
public PreDownloadContentOperation PreDownloadContentAsync(string packageVersion, int timeout = 60)
Returns
YooAsset.PreDownloadContentOperation
Parameters
Type | Name | Description |
---|---|---|
System.String | packageVersion | 下载的包裹版本 |
System.Int32 | timeout | 超时时间(默认值:60秒) |
ClearUnusedCacheFilesAsync()
清理包裹未使用的缓存文件
View Source
public ClearUnusedCacheFilesOperation ClearUnusedCacheFilesAsync()
Returns
YooAsset.ClearUnusedCacheFilesOperation
GetPackageVersion()
获取本地包裹的版本信息
View Source
public string GetPackageVersion()
Returns
System.String
UnloadUnusedAssets()
资源回收(卸载引用计数为零的资源)
View Source
public void UnloadUnusedAssets()
ForceUnloadAllAssets()
强制回收所有资源
View Source
public void ForceUnloadAllAssets()
IsNeedDownloadFromRemote(string)
是否需要从远端更新下载
View Source
public bool IsNeedDownloadFromRemote(string location)
Returns
System.Boolean
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
IsNeedDownloadFromRemote(AssetInfo)
是否需要从远端更新下载
View Source
public bool IsNeedDownloadFromRemote(AssetInfo assetInfo)
Returns
System.Boolean
Parameters
Type | Name |
---|---|
YooAsset.AssetInfo | assetInfo |
GetAssetInfos(string)
获取资源信息列表
View Source
public AssetInfo[] GetAssetInfos(string tag)
Returns
YooAsset.AssetInfo[]
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | 资源标签 |
GetAssetInfos(string[])
获取资源信息列表
View Source
public AssetInfo[] GetAssetInfos(string[] tags)
Returns
YooAsset.AssetInfo[]
Parameters
Type | Name | Description |
---|---|---|
System.String[] | tags | 资源标签列表 |
GetAssetInfo(string)
获取资源信息
View Source
public AssetInfo GetAssetInfo(string location)
Returns
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
CheckLocationValid(string)
检查资源定位地址是否有效
View Source
public bool CheckLocationValid(string location)
Returns
System.Boolean
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
LoadRawFileSync(AssetInfo)
同步加载原生文件
View Source
public RawFileOperationHandle LoadRawFileSync(AssetInfo assetInfo)
Returns
YooAsset.RawFileOperationHandle
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 资源信息 |
LoadRawFileSync(string)
同步加载原生文件
View Source
public RawFileOperationHandle LoadRawFileSync(string location)
Returns
YooAsset.RawFileOperationHandle
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
LoadRawFileAsync(AssetInfo)
异步加载原生文件
View Source
public RawFileOperationHandle LoadRawFileAsync(AssetInfo assetInfo)
Returns
YooAsset.RawFileOperationHandle
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 资源信息 |
LoadRawFileAsync(string)
异步加载原生文件
View Source
public RawFileOperationHandle LoadRawFileAsync(string location)
Returns
YooAsset.RawFileOperationHandle
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
LoadSceneAsync(string, LoadSceneMode, bool, int)
异步加载场景
View Source
public SceneOperationHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
Returns
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 场景的定位地址 |
UnityEngine.SceneManagement.LoadSceneMode | sceneMode | 场景加载模式 |
System.Boolean | activateOnLoad | 加载完毕时是否主动激活 |
System.Int32 | priority | 优先级 |
LoadSceneAsync(AssetInfo, LoadSceneMode, bool, int)
异步加载场景
View Source
public SceneOperationHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, bool activateOnLoad = true, int priority = 100)
Returns
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 场景的资源信息 |
UnityEngine.SceneManagement.LoadSceneMode | sceneMode | 场景加载模式 |
System.Boolean | activateOnLoad | 加载完毕时是否主动激活 |
System.Int32 | priority | 优先级 |
LoadAssetSync(AssetInfo)
同步加载资源对象
View Source
public AssetOperationHandle LoadAssetSync(AssetInfo assetInfo)
Returns
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 资源信息 |
LoadAssetSync<TObject>(string)
同步加载资源对象
View Source
public AssetOperationHandle LoadAssetSync<TObject>(string location) where TObject : Object
Returns
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
Type Parameters
Name | Description |
---|---|
TObject | 资源类型 |
LoadAssetSync(string, Type)
同步加载资源对象
View Source
public AssetOperationHandle LoadAssetSync(string location, Type type)
Returns
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
System.Type | type | 资源类型 |
LoadAssetAsync(AssetInfo)
异步加载资源对象
View Source
public AssetOperationHandle LoadAssetAsync(AssetInfo assetInfo)
Returns
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 资源信息 |
LoadAssetAsync<TObject>(string)
异步加载资源对象
View Source
public AssetOperationHandle LoadAssetAsync<TObject>(string location) where TObject : Object
Returns
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
Type Parameters
Name | Description |
---|---|
TObject | 资源类型 |
LoadAssetAsync(string, Type)
异步加载资源对象
View Source
public AssetOperationHandle LoadAssetAsync(string location, Type type)
Returns
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
System.Type | type | 资源类型 |
LoadSubAssetsSync(AssetInfo)
同步加载子资源对象
View Source
public SubAssetsOperationHandle LoadSubAssetsSync(AssetInfo assetInfo)
Returns
YooAsset.SubAssetsOperationHandle
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 资源信息 |
LoadSubAssetsSync<TObject>(string)
同步加载子资源对象
View Source
public SubAssetsOperationHandle LoadSubAssetsSync<TObject>(string location) where TObject : Object
Returns
YooAsset.SubAssetsOperationHandle
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
Type Parameters
Name | Description |
---|---|
TObject | 资源类型 |
LoadSubAssetsSync(string, Type)
同步加载子资源对象
View Source
public SubAssetsOperationHandle LoadSubAssetsSync(string location, Type type)
Returns
YooAsset.SubAssetsOperationHandle
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
System.Type | type | 子对象类型 |
LoadSubAssetsAsync(AssetInfo)
异步加载子资源对象
View Source
public SubAssetsOperationHandle LoadSubAssetsAsync(AssetInfo assetInfo)
Returns
YooAsset.SubAssetsOperationHandle
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 资源信息 |
LoadSubAssetsAsync<TObject>(string)
异步加载子资源对象
View Source
public SubAssetsOperationHandle LoadSubAssetsAsync<TObject>(string location) where TObject : Object
Returns
YooAsset.SubAssetsOperationHandle
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
Type Parameters
Name | Description |
---|---|
TObject | 资源类型 |
LoadSubAssetsAsync(string, Type)
异步加载子资源对象
View Source
public SubAssetsOperationHandle LoadSubAssetsAsync(string location, Type type)
Returns
YooAsset.SubAssetsOperationHandle
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
System.Type | type | 子对象类型 |
CreateResourceDownloader(int, int, int)
创建资源下载器,用于下载当前资源版本所有的资源包文件
View Source
public ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
Returns
YooAsset.ResourceDownloaderOperation
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | downloadingMaxNumber | 同时下载的最大文件数 |
System.Int32 | failedTryAgain | 下载失败的重试次数 |
System.Int32 | timeout | 超时时间 |
CreateResourceDownloader(string, int, int, int)
创建资源下载器,用于下载指定的资源标签关联的资源包文件
View Source
public ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
Returns
YooAsset.ResourceDownloaderOperation
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | 资源标签 |
System.Int32 | downloadingMaxNumber | 同时下载的最大文件数 |
System.Int32 | failedTryAgain | 下载失败的重试次数 |
System.Int32 | timeout | 超时时间 |
CreateResourceDownloader(string[], int, int, int)
创建资源下载器,用于下载指定的资源标签列表关联的资源包文件
View Source
public ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
Returns
YooAsset.ResourceDownloaderOperation
Parameters
Type | Name | Description |
---|---|---|
System.String[] | tags | 资源标签列表 |
System.Int32 | downloadingMaxNumber | 同时下载的最大文件数 |
System.Int32 | failedTryAgain | 下载失败的重试次数 |
System.Int32 | timeout | 超时时间 |
CreateBundleDownloader(string, int, int, int)
创建资源下载器,用于下载指定的资源依赖的资源包文件
View Source
public ResourceDownloaderOperation CreateBundleDownloader(string location, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
Returns
YooAsset.ResourceDownloaderOperation
Parameters
Type | Name | Description |
---|---|---|
System.String | location | 资源的定位地址 |
System.Int32 | downloadingMaxNumber | 同时下载的最大文件数 |
System.Int32 | failedTryAgain | 下载失败的重试次数 |
System.Int32 | timeout | 超时时间 |
CreateBundleDownloader(string[], int, int, int)
创建资源下载器,用于下载指定的资源列表依赖的资源包文件
View Source
public ResourceDownloaderOperation CreateBundleDownloader(string[] locations, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
Returns
YooAsset.ResourceDownloaderOperation
Parameters
Type | Name | Description |
---|---|---|
System.String[] | locations | 资源的定位地址列表 |
System.Int32 | downloadingMaxNumber | 同时下载的最大文件数 |
System.Int32 | failedTryAgain | 下载失败的重试次数 |
System.Int32 | timeout | 超时时间 |
CreateBundleDownloader(AssetInfo, int, int, int)
创建资源下载器,用于下载指定的资源依赖的资源包文件
View Source
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo assetInfo, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
Returns
YooAsset.ResourceDownloaderOperation
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo | assetInfo | 资源信息 |
System.Int32 | downloadingMaxNumber | 同时下载的最大文件数 |
System.Int32 | failedTryAgain | 下载失败的重试次数 |
System.Int32 | timeout | 超时时间 |
CreateBundleDownloader(AssetInfo[], int, int, int)
创建资源下载器,用于下载指定的资源列表依赖的资源包文件
View Source
public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain, int timeout = 60)
Returns
YooAsset.ResourceDownloaderOperation
Parameters
Type | Name | Description |
---|---|---|
YooAsset.AssetInfo[] | assetInfos | 资源信息列表 |
System.Int32 | downloadingMaxNumber | 同时下载的最大文件数 |
System.Int32 | failedTryAgain | 下载失败的重试次数 |
System.Int32 | timeout | 超时时间 |
CreateResourceUnpacker(string, int, int)
创建内置资源解压器
View Source
public ResourceUnpackerOperation CreateResourceUnpacker(string tag, int unpackingMaxNumber, int failedTryAgain)
Returns
YooAsset.ResourceUnpackerOperation
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | 资源标签 |
System.Int32 | unpackingMaxNumber | 同时解压的最大文件数 |
System.Int32 | failedTryAgain | 解压失败的重试次数 |
CreateResourceUnpacker(string[], int, int)
创建内置资源解压器
View Source
public ResourceUnpackerOperation CreateResourceUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
Returns
YooAsset.ResourceUnpackerOperation
Parameters
Type | Name | Description |
---|---|---|
System.String[] | tags | 资源标签列表 |
System.Int32 | unpackingMaxNumber | 同时解压的最大文件数 |
System.Int32 | failedTryAgain | 解压失败的重试次数 |
CreateResourceUnpacker(int, int)
创建内置资源解压器
View Source
public ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
Returns
YooAsset.ResourceUnpackerOperation
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | unpackingMaxNumber | 同时解压的最大文件数 |
System.Int32 | failedTryAgain | 解压失败的重试次数 |