diff --git a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs index c4f609f..e4ec38a 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs @@ -571,6 +571,18 @@ namespace YooAsset return LoadAssetInternal(assetInfo, true); } + /// + /// 同步加载资源对象 + /// + /// 资源的定位地址 + public AssetOperationHandle LoadAssetSync(string location) + { + DebugCheckInitialize(); + Type type = typeof(UnityEngine.Object); + AssetInfo assetInfo = ConvertLocationToAssetInfo(location, type); + return LoadAssetInternal(assetInfo, true); + } + /// /// 异步加载资源对象 @@ -606,6 +618,18 @@ namespace YooAsset return LoadAssetInternal(assetInfo, false); } + /// + /// 异步加载资源对象 + /// + /// 资源的定位地址 + public AssetOperationHandle LoadAssetAsync(string location) + { + DebugCheckInitialize(); + Type type = typeof(UnityEngine.Object); + AssetInfo assetInfo = ConvertLocationToAssetInfo(location, type); + return LoadAssetInternal(assetInfo, false); + } + private AssetOperationHandle LoadAssetInternal(AssetInfo assetInfo, bool waitForAsyncComplete) { @@ -660,6 +684,18 @@ namespace YooAsset return LoadSubAssetsInternal(assetInfo, true); } + /// + /// 同步加载子资源对象 + /// + /// 资源的定位地址 + public SubAssetsOperationHandle LoadSubAssetsSync(string location) + { + DebugCheckInitialize(); + Type type = typeof(UnityEngine.Object); + AssetInfo assetInfo = ConvertLocationToAssetInfo(location, type); + return LoadSubAssetsInternal(assetInfo, true); + } + /// /// 异步加载子资源对象 @@ -695,6 +731,18 @@ namespace YooAsset return LoadSubAssetsInternal(assetInfo, false); } + /// + /// 异步加载子资源对象 + /// + /// 资源的定位地址 + public SubAssetsOperationHandle LoadSubAssetsAsync(string location) + { + DebugCheckInitialize(); + Type type = typeof(UnityEngine.Object); + AssetInfo assetInfo = ConvertLocationToAssetInfo(location, type); + return LoadSubAssetsInternal(assetInfo, false); + } + private SubAssetsOperationHandle LoadSubAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete) { @@ -749,6 +797,18 @@ namespace YooAsset return LoadAllAssetsInternal(assetInfo, true); } + /// + /// 同步加载资源包内所有资源对象 + /// + /// 资源的定位地址 + public AllAssetsOperationHandle LoadAllAssetsSync(string location) + { + DebugCheckInitialize(); + Type type = typeof(UnityEngine.Object); + AssetInfo assetInfo = ConvertLocationToAssetInfo(location, type); + return LoadAllAssetsInternal(assetInfo, true); + } + /// /// 异步加载资源包内所有资源对象 @@ -784,6 +844,18 @@ namespace YooAsset return LoadAllAssetsInternal(assetInfo, false); } + /// + /// 异步加载资源包内所有资源对象 + /// + /// 资源的定位地址 + public AllAssetsOperationHandle LoadAllAssetsAsync(string location) + { + DebugCheckInitialize(); + Type type = typeof(UnityEngine.Object); + AssetInfo assetInfo = ConvertLocationToAssetInfo(location, type); + return LoadAllAssetsInternal(assetInfo, false); + } + private AllAssetsOperationHandle LoadAllAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete) {