123456789101112131415161718192021222324252627282930313233343536 |
- using UnityEngine;
- namespace XGame.Framework.Asset
- {
- internal static class AssetCreator
- {
- internal static Asset Create(string addressableName, object obj)
- {
- if (obj == null)
- {
- AssetsLog.Warn($"Asset create error: object is null. Path:{addressableName}");
- return null;
- }
- Asset asset;
- if (obj is AssetBundle)
- {
- asset = new BundleAsset();
- }
- else if (obj is Object)
- {
- asset = new ObjectAsset();
- Monitor.AssetsMonitor.RecordAsset(addressableName, obj);
- }
- else
- {
- asset = new BinaryAsset();
- }
- asset.Init(addressableName);
- asset.Source = obj;
- return asset;
- }
- }
- }
|