瀏覽代碼

换装报错fix

guodong 3 年之前
父節點
當前提交
8ad74783f7
共有 1 個文件被更改,包括 11 次插入8 次删除
  1. 11 8
      GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

+ 11 - 8
GameClient/Assets/Game/HotUpdate/DressUp/DressUpUtil.cs

@@ -195,18 +195,21 @@ namespace GFGGame
                 AddAnimationObj(res, aniObjName, parentObj, sortingOrder);
                 Timers.inst.Add(0.03f, 1, (obj) =>
                 {
-                    Transform tf = parentObj.transform.Find(spritObjName);
-                    if (tf != null && tf.gameObject != null && tf.gameObject.activeInHierarchy)
+                    if(parentObj != null && parentObj.transform != null)
                     {
-                        var assetDisposer = tf.gameObject.GetComponent<AssetReleaser>();
-                        if (assetDisposer != null)
+                        Transform tf = parentObj.transform.Find(spritObjName);
+                        if (tf != null && tf.gameObject != null && tf.gameObject.activeInHierarchy)
                         {
-                            if (!string.IsNullOrEmpty(assetDisposer.resPath))
+                            var assetDisposer = tf.gameObject.GetComponent<AssetReleaser>();
+                            if (assetDisposer != null)
                             {
-                                string resPath = ResPathUtil.GetDressUpPath(res, ext);
-                                if (assetDisposer.resPath == resPath)
+                                if (!string.IsNullOrEmpty(assetDisposer.resPath))
                                 {
-                                    TryClearSpriteObj(parentObj, spritObjName);
+                                    string resPath = ResPathUtil.GetDressUpPath(res, ext);
+                                    if (assetDisposer.resPath == resPath)
+                                    {
+                                        TryClearSpriteObj(parentObj, spritObjName);
+                                    }
                                 }
                             }
                         }