You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 20:20:06 +00:00
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))
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -240,6 +240,7 @@ namespace Coffee.UIExtensions
|
||||
// Combine
|
||||
Profiler.BeginSample("[UIParticle] Bake Mesh > CombineMesh");
|
||||
MeshHelper.CombineMesh(particle.bakedMesh);
|
||||
MeshHelper.Clear();
|
||||
Profiler.EndSample();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user