Browse Source

资源释放

zhaoyang 3 years ago
parent
commit
bbd5ccc940
1 changed files with 2 additions and 12 deletions
  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)
             {