UGUI导出工具

This commit is contained in:
2025-07-16 13:36:21 +08:00
parent 9c65b58134
commit 60c1185b87
20 changed files with 1726 additions and 31 deletions

View File

@@ -1,4 +1,11 @@
namespace CreatGame.AssetBundle
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.AddressableAssets.ResourceLocators;
using UnityEngine.ResourceManagement.AsyncOperations;
using UnityEngine.ResourceManagement.ResourceLocations;
namespace CreatGame.AssetBundle
{
public class AssetBundleManager : Singleton<AssetBundleManager>
{
@@ -7,7 +14,47 @@
/// </summary>
public AssetBundleManager()
{
Addressables.InitializeAsync();
}
public void Initialize()
{
Addressables.InitializeAsync().Completed += OnInitializeCompleted;
}
/// <summary>
/// 初始化信息回调
/// </summary>
private void OnInitializeCompleted(AsyncOperationHandle<IResourceLocator> operationHandle)
{
if (operationHandle.Status == AsyncOperationStatus.Succeeded)
{
Debug.Log("Addressables initialization succeeded");
#region MyRegion
// IResourceLocator locator = operationHandle.Result;
// foreach (object locatorKey in locator.Keys)
// {
// locator.Locate(locatorKey,typeof(UnityEngine.Object),out IList<IResourceLocation> locations);
// if (locations == null)
// {
// continue;
// }
//
// foreach (var location in locations)
// {
// string key = location.PrimaryKey;
// Addressables.LoadAssetAsync<UnityEngine.Object>(key).Completed += (handle) =>
// {
// if (handle.Status == AsyncOperationStatus.Succeeded)
// {
// Debug.Log("Addressables load asset succeeded");
// var asset = handle.Result;
// GameObject.Instantiate(asset);
// }
// };
// }
// }
#endregion
}
}
}
}