diff --git a/README.md b/README.md index c1102f0..4709d57 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ You can render, mask, and sort your `ParticleSystems` for UI without the need fo - [Usage with `Mask` or `RectMask2D` Component](#usage-with-mask-or-rectmask2d-component) - [Usage with Script](#usage-with-script) - [Component: UIParticleAttractor](#component-uiparticleattractor) + - [Component: ParticleSystemPreviewer](#component-particlesystempreviewer) - [Project Settings](#project-settings) - [🛠 Development Note](#-development-note) - [Compares the Baking mesh approach with the conventional approach](#compares-the-baking-mesh-approach-with-the-conventional-approach) @@ -116,7 +117,7 @@ _This package requires **Unity 2018.3 or later**._ ``` - To update the package, use Package Manager UI (`Window > Package Manager`) or run the following command with `@{version}`: ``` - openupm add com.coffee.ui-particle@4.9.0 + openupm add com.coffee.ui-particle@4.13.0 ``` #### Install via UPM (with Package Manager UI) @@ -125,7 +126,7 @@ _This package requires **Unity 2018.3 or later**._ - Click `+ > Add package from git URL...` and input the repository URL: `https://github.com/mob-sakai/ParticleEffectForUGUI.git` ![](https://github.com/user-attachments/assets/f88f47ad-c606-44bd-9e86-ee3f72eac548) - To update the package, change suffix `#{version}` to the target version. - - e.g. `https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.9.0` + - e.g. `https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.13.0` #### Install via UPM (Manually) @@ -140,7 +141,7 @@ _This package requires **Unity 2018.3 or later**._ ``` - To update the package, change suffix `#{version}` to the target version. - - e.g. `"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.9.0",` + - e.g. `"com.coffee.ui-particle": "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.13.0",` #### Install as Embedded Package @@ -271,16 +272,17 @@ uiParticle.Stop(); - **Unscaled Time:** Update with unscaled delta time. - **OnAttracted**: An event called when attracting is complete (per particle). -

### Component: ParticleSystemPreviewer -`ParticleSystemPreviewer` is used to preview a ParticleSystem in the editor. +`ParticleSystemPreviewer` is used to preview a `ParticleSystem` in the editor. + +![](https://github.com/mob-sakai/mob-sakai/releases/download/docs/1782441157549.png) - When a `GameObject` with this component is selected in the editor, a temporary `ParticleSystem` is added if needed so you can preview the effect in the Scene view. - The generated `ParticleSystem` is marked with `HideFlags.DontSave`, so it is neither saved nor included in builds. - +- This component will be removed in builds.

diff --git a/Runtime/ParticleSystemPreviewer.cs b/Runtime/ParticleSystemPreviewer.cs index a884fe5..d1be52b 100644 --- a/Runtime/ParticleSystemPreviewer.cs +++ b/Runtime/ParticleSystemPreviewer.cs @@ -1,3 +1,4 @@ +#if UNITY_EDITOR using System.Collections.Generic; using System.Linq; using Coffee.UIParticleInternal; @@ -13,7 +14,6 @@ namespace Coffee.UIExtensions // Do nothing. } -#if UNITY_EDITOR [CustomEditor(typeof(ParticleSystemPreviewer))] [CanEditMultipleObjects] internal class ParticleSystemPreviewerEditor : Editor @@ -29,6 +29,7 @@ namespace Coffee.UIExtensions public override void OnInspectorGUI() { base.OnInspectorGUI(); + EditorGUILayout.HelpBox("ParticleSystemPreviewer will be removed in build.", MessageType.Warning); ParticleSystemPreviewSystem.DrawWarningForTemporary(_gameObjects); ParticleSystemPreviewSystem.DrawWarningForPermanent(_gameObjects); } @@ -43,6 +44,12 @@ namespace Coffee.UIExtensions { private const HideFlags k_TemporaryHideFlags = HideFlags.DontSave | HideFlags.NotEditable; + private const string k_TemporaryMesssage = "The temporary ParticleSystem for preview is attached.\n" + + "It will be removed when exiting edit mode."; + + private const string k_PermanentMesssage = "The permanent ParticleSystem is attached.\n" + + "It will be included in build."; + [SerializeField] private List m_PreviewObjects = new List(); @@ -192,8 +199,7 @@ namespace Coffee.UIExtensions { if (gameObjects == null || gameObjects.Length == 0 || !gameObjects.Any(HasTemporaryParticleSystem)) return; - if (WarningButton("The temporary ParticleSystem for preview is attached.\n" + - "It will be removed when exiting edit mode.", "Remove")) + if (HelpBoxButton(MessageType.Warning, k_TemporaryMesssage, "Remove")) { foreach (var go in gameObjects) { @@ -209,8 +215,7 @@ namespace Coffee.UIExtensions { if (gameObjects == null || gameObjects.Length == 0 || !gameObjects.Any(HasPermanentParticleSystem)) return; - if (WarningButton("The permanent ParticleSystem is attached.\n" + - "It will be included in build.", "Remove")) + if (HelpBoxButton(MessageType.Info, k_PermanentMesssage, "Remove")) { foreach (var go in gameObjects) { @@ -224,14 +229,14 @@ namespace Coffee.UIExtensions } } - private static bool WarningButton(string message, string buttonText) + private static bool HelpBoxButton(MessageType messageType, string message, string buttonText) { EditorGUILayout.BeginHorizontal(); - EditorGUILayout.HelpBox(message, MessageType.Warning, true); + EditorGUILayout.HelpBox(message, messageType, true); var clicked = GUILayout.Button(EditorGUIUtility.TrTempContent(buttonText)); EditorGUILayout.EndHorizontal(); return clicked; } } -#endif } +#endif