Skip to content

Commit 5b149c2

Browse files
author
wanderer
committed
增加Resource加载Object的接口
1 parent 5854ae3 commit 5b149c2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

GameFramework/Runtime/Resource/ResourceManagerExtension.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ namespace Wanderer.GameFramework
77
{
88
public static class ResourceManagerExtension
99
{
10+
//Object
11+
public static void LoadObject(this ResourceManager resource, string assetPath, Action<UnityEngine.Object> callback)
12+
{
13+
resource.Asset.LoadAsset<UnityEngine.Object>(assetPath, callback);
14+
}
15+
16+
public static UnityEngine.Object LoadObjectSync(this ResourceManager resource, string assetPath)
17+
{
18+
return resource.Asset.LoadAsset<UnityEngine.Object>(assetPath);
19+
}
20+
21+
//GameObject
1022
public static void LoadGameObject(this ResourceManager resource, string assetPath, Action<GameObject> callback)
1123
{
1224
resource.Asset.LoadAsset<GameObject>(assetPath, callback);
@@ -17,6 +29,7 @@ public static GameObject LoadGameObjectSync(this ResourceManager resource, strin
1729
return resource.Asset.LoadAsset<GameObject>(assetPath);
1830
}
1931

32+
//Texture
2033
public static void LoadTextAsset(this ResourceManager resource, string assetPath, Action<TextAsset> callback)
2134
{
2235
resource.Asset.LoadAsset<TextAsset>(assetPath, callback);
@@ -26,7 +39,8 @@ public static TextAsset LoadTextAssetSync(this ResourceManager resource, string
2639
{
2740
return resource.Asset.LoadAsset<TextAsset>(assetPath);
2841
}
29-
42+
43+
//Sprite
3044
public static void LoadSprite(this ResourceManager resource, string assetPath, Action<Sprite> callback)
3145
{
3246
resource.Asset.LoadAsset<Sprite>(assetPath, callback);

0 commit comments

Comments
 (0)