Skip to content

Commit

Permalink
3.0.0-preview.32
Browse files Browse the repository at this point in the history
# [3.0.0-preview.32](mob-sakai/ParticleEffectForUGUI@v3.0.0-preview.31...v3.0.0-preview.32) (2020-09-14)

### Bug Fixes

* animatable properties not working ([5b8b0bd](mob-sakai/ParticleEffectForUGUI@5b8b0bd)), closes [#95](mob-sakai/ParticleEffectForUGUI#95)
  • Loading branch information
LionelPerrault committed Sep 14, 2020
1 parent 304121d commit fe4516c
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)


Expand Down
3 changes: 2 additions & 1 deletion Scripts/BakingCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ public static Camera GetCamera(Canvas canvas)
? 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;
}
Expand Down
27 changes: 27 additions & 0 deletions Scripts/UIParticle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,33 @@ private Material GetModifiedMaterial(Material baseMaterial, Texture2D texture)
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<ParticleSystemRenderer>();
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;
Expand Down
2 changes: 1 addition & 1 deletion Scripts/UIParticleUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static void Refresh(UIParticle particle)
Profiler.EndSample();

Profiler.BeginSample("[UIParticle] Update Animatable Material Properties");
// UpdateAnimatableMaterialProperties(particle);
particle.UpdateMaterialProperties();
Profiler.EndSample();
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down

0 comments on commit fe4516c

Please sign in to comment.