From 3d1e7f70190e7e8571332533a9b5640ed6a200ef Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Thu, 10 Jan 2019 22:12:16 +0900 Subject: [PATCH 1/7] Update README.md --- README.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ecec5e1..8932590 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ The particle rendering is maskable and sortable, without Camera, RenderTexture o [![](https://img.shields.io/github/release/mob-sakai/ParticleEffectForUGUI.svg?label=latest%20version)](https://github.com/mob-sakai/ParticleEffectForUGUI/releases) [![](https://img.shields.io/github/release-date/mob-sakai/ParticleEffectForUGUI.svg)](https://github.com/mob-sakai/ParticleEffectForUGUI/releases) ![](https://img.shields.io/badge/requirement-Unity%202018.2%2B-green.svg) -[![](https://img.shields.io/github/license/mob-sakai/ParticleEffectForUGUI.svg)](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/master/LICENSE.txt) -[![](https://img.shields.io/github/last-commit/mob-sakai/ParticleEffectForUGUI/develop.svg?label=last%20commit%20to%20develop)](https://github.com/mob-sakai/ParticleEffectForUGUI/commits/develop) -[![](https://img.shields.io/github/issues/mob-sakai/ParticleEffectForUGUI.svg)](https://github.com/mob-sakai/ParticleEffectForUGUI/issues) +[![](https://img.shields.io/github/license/mob-sakai/ParticleEffectForUGUI.svg)](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/master/LICENSE.txt) +[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-orange.svg)](http://makeapullrequest.com) +[![](https://img.shields.io/twitter/follow/mob_sakai.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai) @@ -17,6 +17,7 @@ The particle rendering is maskable and sortable, without Camera, RenderTexture o ### What's new? Please see [See changelog ![](https://img.shields.io/github/release-date/mob-sakai/ParticleEffectForUGUI.svg?label=last%20updated&style=for-the-badge)](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/master/CHANGELOG.md) ### Do you want to receive notifications for new releases? [Watch this repo ![](https://img.shields.io/github/watchers/mob-sakai/ParticleEffectForUGUI.svg?style=social&label=Watch)](https://github.com/mob-sakai/ParticleEffectForUGUI/subscription) +### Support me on Patreon! [![become_a_patron](https://user-images.githubusercontent.com/12690315/50731629-3b18b480-11ad-11e9-8fad-4b13f27969c1.png)](https://www.patreon.com/join/2343451?) @@ -104,7 +105,8 @@ Compares this "Baking mesh" approach with the conventional approach: ## Author -[mob-sakai](https://github.com/mob-sakai) +[mob-sakai](https://github.com/mob-sakai) +[![](https://img.shields.io/twitter/follow/mob_sakai.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai) From 87c554ae02d0961c3ecd69eb6f3ee2a2eac7f358 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Thu, 10 Jan 2019 22:13:29 +0900 Subject: [PATCH 2/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8932590..64ee80e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ The particle rendering is maskable and sortable, without Camera, RenderTexture o << [Description](#Description) | [WebGL Demo](#demo) | [Download](https://github.com/mob-sakai/ParticleEffectForUGUI/releases) | [Usage](#usage) | [Development Note](#development-note) | [Change log](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/master/CHANGELOG.md) >> -### What's new? Please see [See changelog ![](https://img.shields.io/github/release-date/mob-sakai/ParticleEffectForUGUI.svg?label=last%20updated&style=for-the-badge)](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/master/CHANGELOG.md) +### What's new? Please see [See changelog ![](https://img.shields.io/github/release-date/mob-sakai/ParticleEffectForUGUI.svg?label=last%20updated)](https://github.com/mob-sakai/ParticleEffectForUGUI/blob/master/CHANGELOG.md) ### Do you want to receive notifications for new releases? [Watch this repo ![](https://img.shields.io/github/watchers/mob-sakai/ParticleEffectForUGUI.svg?style=social&label=Watch)](https://github.com/mob-sakai/ParticleEffectForUGUI/subscription) ### Support me on Patreon! [![become_a_patron](https://user-images.githubusercontent.com/12690315/50731629-3b18b480-11ad-11e9-8fad-4b13f27969c1.png)](https://www.patreon.com/join/2343451?) From 96e07ecfb451b06359b266d10eb8f235d0792d62 Mon Sep 17 00:00:00 2001 From: Takashi Sakai Date: Thu, 10 Jan 2019 22:15:30 +0900 Subject: [PATCH 3/7] Update README.md --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 64ee80e..3dac7e3 100644 --- a/README.md +++ b/README.md @@ -105,8 +105,9 @@ Compares this "Baking mesh" approach with the conventional approach: ## Author -[mob-sakai](https://github.com/mob-sakai) -[![](https://img.shields.io/twitter/follow/mob_sakai.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai) +[mob-sakai](https://github.com/mob-sakai) +[![](https://img.shields.io/twitter/follow/mob_sakai.svg?label=Follow&style=social)](https://twitter.com/intent/follow?screen_name=mob_sakai) +[![become_a_patron](https://user-images.githubusercontent.com/12690315/50731629-3b18b480-11ad-11e9-8fad-4b13f27969c1.png)](https://www.patreon.com/join/2343451?) From 31f62d8854cfe62433a3bba06eae704503f82f85 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Tue, 15 Jan 2019 15:49:39 +0900 Subject: [PATCH 4/7] fix #35; On prefab edit mode, unnecessary UIParticleOverlayCamera is generated in the scene --- .../UIParticle/UIParticleOverlayCamera.cs | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/Assets/Coffee/UIExtensions/UIParticle/UIParticleOverlayCamera.cs b/Assets/Coffee/UIExtensions/UIParticle/UIParticleOverlayCamera.cs index 2433e9e..68ed592 100644 --- a/Assets/Coffee/UIExtensions/UIParticle/UIParticleOverlayCamera.cs +++ b/Assets/Coffee/UIExtensions/UIParticle/UIParticleOverlayCamera.cs @@ -1,6 +1,9 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; +#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR +using PrefabStageUtility = UnityEditor.Experimental.SceneManagement.PrefabStageUtility; +#endif namespace Coffee.UIExtensions { @@ -20,6 +23,28 @@ namespace Coffee.UIExtensions { get { +#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + // If current scene is prefab mode, create OverlayCamera for editor. + var prefabStage = PrefabStageUtility.GetCurrentPrefabStage (); + if (prefabStage != null && prefabStage.scene.isLoaded) + { + if (!s_InstanceForPrefabMode) + { + // This GameObject is not saved in prefab. + // This GameObject is not shown in the hierarchy view. + // When you exit prefab mode, this GameObject is destroyed automatically. + var go = new GameObject (typeof (UIParticleOverlayCamera).Name + "_ForEditor") + { + hideFlags = HideFlags.HideAndDontSave, + tag = "EditorOnly", + }; + UnityEngine.SceneManagement.SceneManager.MoveGameObjectToScene (go, prefabStage.scene); + s_InstanceForPrefabMode = go.AddComponent (); + } + return s_InstanceForPrefabMode; + } +#endif + // Find instance in scene, or create new one. if (object.ReferenceEquals (s_Instance, null)) { @@ -56,12 +81,24 @@ namespace Coffee.UIExtensions Camera cameraForOvrelay { get { return m_Camera ? m_Camera : (m_Camera = GetComponent ()) ? m_Camera : (m_Camera = gameObject.AddComponent ()); } } Camera m_Camera; static UIParticleOverlayCamera s_Instance; +#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + static UIParticleOverlayCamera s_InstanceForPrefabMode; +#endif /// /// Awake is called when the script instance is being loaded. /// void Awake () { +#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + // OverlayCamera for editor. + if (hideFlags == HideFlags.HideAndDontSave || s_InstanceForPrefabMode == this) + { + s_InstanceForPrefabMode = GetComponent (); + return; + } +#endif + // Hold the instance. if (s_Instance == null) { @@ -100,6 +137,13 @@ namespace Coffee.UIExtensions /// void OnDestroy () { +#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR + if (s_InstanceForPrefabMode == this) + { + s_InstanceForPrefabMode = null; + } +#endif + // Clear instance on destroy. if (s_Instance == this) { From cef89e4b18074fb755e134e3c034806549cc06ab Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Tue, 15 Jan 2019 21:58:12 +0900 Subject: [PATCH 5/7] fix #34; With 'Screen Space - Camera' render mode, sorting is incorrect --- Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs b/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs index e9b3321..fe3a1a2 100755 --- a/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs +++ b/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs @@ -264,6 +264,16 @@ namespace Coffee.UIExtensions if (m_ParticleSystem && canvas) { + if (canvas.renderMode != RenderMode.ScreenSpaceOverlay) + { + Vector3 pos = rectTransform.localPosition; + if (Mathf.Abs (pos.z) < 0.01f) + { + pos.z = 0.01f; + rectTransform.localPosition = pos; + } + } + var rootCanvas = canvas.rootCanvas; Profiler.BeginSample ("Disable ParticleSystemRenderer"); if (Application.isPlaying) From 0c6aaabc6a3f40f45aa5bfeebfc827152f313ca9 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Tue, 15 Jan 2019 21:59:27 +0900 Subject: [PATCH 6/7] Fix error --- .../UIExtensions/UIParticle/Editor/UIParticleEditor.cs | 2 +- Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Assets/Coffee/UIExtensions/UIParticle/Editor/UIParticleEditor.cs b/Assets/Coffee/UIExtensions/UIParticle/Editor/UIParticleEditor.cs index 5058708..ab30d1c 100644 --- a/Assets/Coffee/UIExtensions/UIParticle/Editor/UIParticleEditor.cs +++ b/Assets/Coffee/UIExtensions/UIParticle/Editor/UIParticleEditor.cs @@ -143,7 +143,7 @@ namespace Coffee.UIExtensions foreach (UIParticle uip in _particles) { ParticleSystem ps = uip.cachedParticleSystem; - if (!ps) + if (!ps || !uip.canvas) { continue; } diff --git a/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs b/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs index fe3a1a2..537f6ac 100755 --- a/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs +++ b/Assets/Coffee/UIExtensions/UIParticle/UIParticle.cs @@ -242,11 +242,11 @@ namespace Coffee.UIExtensions /// static void UpdateMeshes () { - foreach (var uip in s_ActiveParticles) + for (int i = 0; i < s_ActiveParticles.Count; i++) { - if(uip) + if (s_ActiveParticles [i]) { - uip.UpdateMesh (); + s_ActiveParticles [i].UpdateMesh (); } } } From 8a3b4a55327275f00708771cdad39a8ebd58ec48 Mon Sep 17 00:00:00 2001 From: mob-sakai Date: Wed, 16 Jan 2019 19:09:42 +0900 Subject: [PATCH 7/7] update change log --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 51a245a..2c2b7e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## [v1.3.3](https://github.com/mob-sakai/ParticleEffectForUGUI/tree/v1.3.3) (2019-01-16) + +[Full Changelog](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v1.3.2...v1.3.3) + +**Fixed bugs:** + +- On prefab edit mode, unnecessary UIParticleOverlayCamera is generated in the scene [\#35](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/35) +- With 'Screen Space - Camera' render mode, sorting is incorrect [\#34](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/34) + ## [v1.3.2](https://github.com/mob-sakai/ParticleEffectForUGUI/tree/v1.3.2) (2018-12-29) [Full Changelog](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v1.3.1...v1.3.2) diff --git a/package.json b/package.json index e119aef..1db4848 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ParticleEffectForUGUI", - "version": "1.3.2", + "version": "1.3.3", "repository": { "type": "git", "url": "git+https://github.com/mob-sakai/ParticleEffectForUGUI.git"