fix: ParticleSystemPreviewer is no longer included in build

This commit is contained in:
mob-sakai
2026-06-26 11:22:45 +09:00
parent a7f64c6033
commit 2350ea82d2
2 changed files with 21 additions and 14 deletions

View File

@@ -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 `Mask` or `RectMask2D` Component](#usage-with-mask-or-rectmask2d-component)
- [Usage with Script](#usage-with-script) - [Usage with Script](#usage-with-script)
- [Component: UIParticleAttractor](#component-uiparticleattractor) - [Component: UIParticleAttractor](#component-uiparticleattractor)
- [Component: ParticleSystemPreviewer](#component-particlesystempreviewer)
- [Project Settings](#project-settings) - [Project Settings](#project-settings)
- [🛠 Development Note](#-development-note) - [🛠 Development Note](#-development-note)
- [Compares the Baking mesh approach with the conventional approach](#compares-the-baking-mesh-approach-with-the-conventional-approach) - [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}`: - 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) #### 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` - 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) ![](https://github.com/user-attachments/assets/f88f47ad-c606-44bd-9e86-ee3f72eac548)
- To update the package, change suffix `#{version}` to the target version. - 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) #### 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. - 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 #### Install as Embedded Package
@@ -271,16 +272,17 @@ uiParticle.Stop();
- **Unscaled Time:** Update with unscaled delta time. - **Unscaled Time:** Update with unscaled delta time.
- **OnAttracted**: An event called when attracting is complete (per particle). - **OnAttracted**: An event called when attracting is complete (per particle).
<br><br> <br><br>
### Component: ParticleSystemPreviewer ### 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. - 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. - The generated `ParticleSystem` is marked with `HideFlags.DontSave`, so it is neither saved nor included in builds.
- This component will be removed in builds.
<br><br> <br><br>

View File

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