12345678910111213141516171819202122 |
- using XGame.Framework.Asset;
- namespace XGame.Editor.Asset
- {
- public class AssetLoadHandler : IAssetLoadHandler
- {
- TResult IAssetLoadHandler.LoadSync<TResult>(string addressableName)
- {
- var type = typeof(TResult);
- if (type.IsSubclassOf(typeof(UnityEngine.Object)))
- {
- var assetPath = AddressableHelper.NameToAssetPath(addressableName);
- if (string.IsNullOrEmpty(assetPath) == false)
- {
- var result = UnityEditor.AssetDatabase.LoadAssetAtPath(assetPath, type) as object;
- return (TResult)result;
- }
- }
- return default(TResult);
- }
- }
- }
|