From 64787261dfacdc43c6395b89c972715da441309a Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 14 Sep 2020 09:29:16 +0000 Subject: [PATCH] 3.0.0-preview.32 # [3.0.0-preview.32](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.31...v3.0.0-preview.32) (2020-09-14) ### Bug Fixes * animatable properties not working ([5b8b0bd](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5b8b0bd28b251a7ea6e0cfa0c4b69bd7f9c4d953)), closes [#95](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/95) --- CHANGELOG.md | 7 +++++++ Scripts/BakingCamera.cs | 3 ++- Scripts/UIParticle.cs | 27 +++++++++++++++++++++++++++ Scripts/UIParticleUpdater.cs | 2 +- package.json | 2 +- 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 49f905e..71a2a83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [3.0.0-preview.32](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.31...v3.0.0-preview.32) (2020-09-14) + + +### Bug Fixes + +* animatable properties not working ([5b8b0bd](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/5b8b0bd28b251a7ea6e0cfa0c4b69bd7f9c4d953)), closes [#95](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/95) + # [3.0.0-preview.31](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.30...v3.0.0-preview.31) (2020-09-02) diff --git a/Scripts/BakingCamera.cs b/Scripts/BakingCamera.cs index a88d6cf..9fa0833 100644 --- a/Scripts/BakingCamera.cs +++ b/Scripts/BakingCamera.cs @@ -86,8 +86,9 @@ namespace Coffee.UIExtensions ? camera.transform.rotation : s_OrthoRotation; - transform.SetPositionAndRotation(canvas.transform.position + s_OrthoPosition, rotation); + transform.SetPositionAndRotation(s_OrthoPosition, rotation); Instance._camera.orthographic = true; + Instance._camera.farClipPlane = 2000f; return Instance._camera; } diff --git a/Scripts/UIParticle.cs b/Scripts/UIParticle.cs index 49b416e..93d2bab 100755 --- a/Scripts/UIParticle.cs +++ b/Scripts/UIParticle.cs @@ -272,6 +272,33 @@ namespace Coffee.UIExtensions return baseMaterial; } + internal void UpdateMaterialProperties() + { + if (m_AnimatableProperties.Length == 0) return; + + // + var materialCount = Mathf.Max(8, activeMeshIndices.BitCount()); + canvasRenderer.materialCount = materialCount; + var j = 0; + for (var i = 0; i < particles.Count; i++) + { + if (materialCount <= j) break; + var ps = particles[i]; + if (!ps) continue; + + var r = ps.GetComponent(); + r.GetSharedMaterials(s_TempMaterials); + + // Main + var bit = (long) 1 << (i * 2); + if (0 < (activeMeshIndices & bit) && 0 < s_TempMaterials.Count) + { + UpdateMaterialProperties(r, j); + j++; + } + } + } + internal void UpdateMaterialProperties(Renderer r, int index) { if (m_AnimatableProperties.Length == 0 || canvasRenderer.materialCount <= index) return; diff --git a/Scripts/UIParticleUpdater.cs b/Scripts/UIParticleUpdater.cs index 081d662..ba05cc6 100755 --- a/Scripts/UIParticleUpdater.cs +++ b/Scripts/UIParticleUpdater.cs @@ -79,7 +79,7 @@ namespace Coffee.UIExtensions Profiler.EndSample(); Profiler.BeginSample("[UIParticle] Update Animatable Material Properties"); - // UpdateAnimatableMaterialProperties(particle); + particle.UpdateMaterialProperties(); Profiler.EndSample(); } diff --git a/package.json b/package.json index ba0a55b..9e3cfb8 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.coffee.ui-particle", "displayName": "UI Particle", "description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.", - "version": "3.0.0-preview.31", + "version": "3.0.0-preview.32", "unity": "2018.2", "license": "MIT", "repository": {