瀏覽代碼

资源释放

zhaoyang 3 年之前
父節點
當前提交
bbd5ccc940
共有 1 個文件被更改,包括 2 次插入12 次删除
  1. 2 12
      GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

+ 2 - 12
GameClient/Assets/Game/HotUpdate/DressUp/SceneController.cs

@@ -370,12 +370,7 @@ namespace GFGGame
         {
             if (_gameObject != null)
             {
-                SpriteRenderer spr = _gameObject.GetComponent<SpriteRenderer>();
-                if (spr != null)
-                {
-                    DressUpUtil.TryClearSpriteObj(_gameObject, spr.name);
-                    _gameObject = null;
-                }
+                GameObject.DestroyImmediate(_gameObject);
             }
             _gameObject = DressUpUtil.CreateAnimationObj(res);
             _gameObject.transform.localScale = new Vector3(scale, scale, scale);
@@ -397,12 +392,7 @@ namespace GFGGame
         {
             if (_gameObject != null)
             {
-                SpriteRenderer spr = _gameObject.GetComponent<SpriteRenderer>();
-                if (spr != null)
-                {
-                    DressUpUtil.TryClearSpriteObj(_gameObject, spr.name);
-                    _gameObject = null;
-                }
+                GameObject.DestroyImmediate(_gameObject);
             }
             if (goWrapper != null)
             {