Browse Source

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

leiyasi 1 year ago
parent
commit
4510c9be1f

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