瀏覽代碼

将设置原材质球数值,修改为动态复制材质球

leiyasi 1 年之前
父節點
當前提交
4510c9be1f
共有 1 個文件被更改,包括 12 次插入7 次删除
  1. 12 7
      GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs

+ 12 - 7
GameClient/Assets/Game/HotUpdate/Views/ClothingSynthetic/ClothingSyntheticView.cs

@@ -493,7 +493,17 @@ namespace GFGGame
         {
             var handle = YooAssets.LoadAssetSync<Material>(ResPathUtil.GetPrefabPath("ImageGradient", "mat"));
             Material m = handle.AssetObject as Material;
-            _ui.m_loaBg2.material = m;
+
+            Material copyM = new Material(m.shader);
+            copyM.CopyPropertiesFromMaterial(m);
+
+            AssetReleaser assetReleaser = _ui.m_loaBg2.displayObject.gameObject.GetComponent<AssetReleaser>();
+            if (assetReleaser != null)
+            {
+                //必须立即销毁,不能改为Destroy代替
+                GameObject.DestroyImmediate(assetReleaser);
+            }
+            _ui.m_loaBg2.material = copyM;
             _ui.m_loaBg2.position = _ui.m_loaBg.position;
             float startY = _ui.m_loaBg2Pos.position.y;
             float endY = _ui.m_posHelper.position.y;
@@ -504,12 +514,7 @@ namespace GFGGame
 
         private void RemoveSoftMask()
         {
-            AssetReleaser assetReleaser = _ui.m_loaBg2.displayObject.gameObject.GetComponent<AssetReleaser>();
-            if (assetReleaser != null)
-            {
-                //必须立即销毁,不能改为Destroy代替
-                GameObject.DestroyImmediate(assetReleaser);
-            }
+            _ui.m_loaBg2.material = null;
         }
     }
 }