3.0.0-preview.31

# [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)

### Bug Fixes

* combine Instances error ([878f812](878f81202a)), closes [#91](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/91)
* in rare cases, the particle size is incorrect with camera-space mode ([90593ac](90593ac021)), closes [#93](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/93)
* trails material uses sprite texture ([9e65ee7](9e65ee7345)), closes [#92](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/92)

### Features

* refresh children ParticleSystem with a gameObjects as root ([8bae1d0](8bae1d08cc))
pull/120/head
semantic-release-bot 2020-09-02 16:02:59 +00:00
parent b12b82c172
commit 6f3f4803da
7 changed files with 33 additions and 25 deletions

View File

@ -1,3 +1,17 @@
# [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)
### Bug Fixes
* combine Instances error ([878f812](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/878f81202ac29a8a20f174efa916da64eef99e8a)), closes [#91](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/91)
* in rare cases, the particle size is incorrect with camera-space mode ([90593ac](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/90593ac021ce19d164927e44804354535db047bb)), closes [#93](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/93)
* trails material uses sprite texture ([9e65ee7](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/9e65ee7345e16b5124e94d26f5749999c648f677)), closes [#92](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/92)
### Features
* refresh children ParticleSystem with a gameObjects as root ([8bae1d0](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/8bae1d08cc6f00e2b8d6f336aad92233891da1e4))
# [3.0.0-preview.30](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.29...v3.0.0-preview.30) (2020-09-02)

View File

@ -49,10 +49,8 @@ public class CFX_Demo_With_UIParticle : MonoBehaviour
var particle = demo.GetType()
.GetMethod("spawnParticle", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
.Invoke(demo, new object[0]) as GameObject;
particle.transform.SetParent(UiParticle.transform, false);
particle.transform.localScale = Vector3.one;
particle.transform.localPosition = Vector3.zero;
UiParticle.RefreshParticles();
UiParticle.SetParticleSystemInstance(particle);
}
public void SetCanvasWidth(int width)

View File

@ -82,23 +82,12 @@ namespace Coffee.UIExtensions
var camera = canvas.worldCamera;
var transform = Instance.transform;
if (canvas.renderMode != RenderMode.ScreenSpaceOverlay && camera)
{
var cameraTr = camera.transform;
transform.SetPositionAndRotation(cameraTr.position, cameraTr.rotation);
var rotation = canvas.renderMode != RenderMode.ScreenSpaceOverlay && camera
? camera.transform.rotation
: s_OrthoRotation;
Instance._camera.orthographic = camera.orthographic;
Instance._camera.orthographicSize = camera.orthographicSize;
Instance._camera.fieldOfView = camera.fieldOfView;
Instance._camera.nearClipPlane = camera.nearClipPlane;
Instance._camera.farClipPlane = camera.farClipPlane;
Instance._camera.rect = camera.rect;
}
else
{
Instance._camera.orthographic = true;
transform.SetPositionAndRotation(canvas.transform.position + s_OrthoPosition, s_OrthoRotation);
}
transform.SetPositionAndRotation(canvas.transform.position + s_OrthoPosition, rotation);
Instance._camera.orthographic = true;
return Instance._camera;
}

View File

@ -129,7 +129,7 @@ namespace Coffee.UIExtensions
SetParticleSystemInstance(instance, true);
}
public void SetParticleSystemInstance(GameObject instance, bool destroy)
public void SetParticleSystemInstance(GameObject instance, bool destroyOldParticles)
{
if (!instance) return;
@ -137,7 +137,7 @@ namespace Coffee.UIExtensions
{
var go = child.gameObject;
go.SetActive(false);
if (!destroy) continue;
if (!destroyOldParticles) continue;
#if UNITY_EDITOR
if (!Application.isPlaying)
@ -151,7 +151,7 @@ namespace Coffee.UIExtensions
tr.SetParent(transform, false);
tr.localPosition = Vector3.zero;
RefreshParticles();
RefreshParticles(instance);
}
public void SetParticleSystemPrefab(GameObject prefab)
@ -163,7 +163,13 @@ namespace Coffee.UIExtensions
public void RefreshParticles()
{
GetComponentsInChildren(particles);
RefreshParticles(gameObject);
}
public void RefreshParticles(GameObject root)
{
if (!root) return;
root.GetComponentsInChildren(particles);
foreach (var ps in particles)
{

View File

@ -240,6 +240,7 @@ namespace Coffee.UIExtensions
// Combine
Profiler.BeginSample("[UIParticle] Bake Mesh > CombineMesh");
MeshHelper.CombineMesh(particle.bakedMesh);
MeshHelper.Clear();
Profiler.EndSample();
}

View File

@ -180,7 +180,7 @@ namespace Coffee.UIExtensions
if (!mat) return 0;
var tex = self.GetTextureForSprite();
var tex = trail ? null : self.GetTextureForSprite();
return ((long) mat.GetHashCode() << 32) + (tex ? tex.GetHashCode() : 0);
}

View File

@ -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.30",
"version": "3.0.0-preview.31",
"unity": "2018.2",
"license": "MIT",
"repository": {