From ae5fe1185eeb1176ccdc384e411687f754dd8863 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Wed, 6 Jul 2022 17:22:22 +0800 Subject: [PATCH] Update Utils.cs --- Assets/TEngine/Runtime/Unitity/Utils.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Assets/TEngine/Runtime/Unitity/Utils.cs b/Assets/TEngine/Runtime/Unitity/Utils.cs index f2439986..049087cc 100644 --- a/Assets/TEngine/Runtime/Unitity/Utils.cs +++ b/Assets/TEngine/Runtime/Unitity/Utils.cs @@ -167,7 +167,7 @@ namespace TEngine int splitIndex = path.LastIndexOf('#'); string resPath; bool bWithSubAssets; - string subAssetName; + string subAssetName = string.Empty; if (splitIndex > 0) { resPath = path.Substring(0, splitIndex); @@ -201,10 +201,9 @@ namespace TEngine if (bWithSubAssets) { - string name = path.Split('.')[0]; - if (asset[name] != null) + if (asset[subAssetName] != null) { - image.sprite = asset[name] as Sprite; + image.sprite = asset[subAssetName] as Sprite; } } else