Compare commits

...

25 Commits

Author SHA1 Message Date
mob-sakai
4f79848a7c Merge remote-tracking branch 'origin/release' into develop-preview
# Conflicts:
#	Packages/src/CHANGELOG.md
#	Packages/src/package.json
2026-03-24 17:54:06 +09:00
semantic-release-bot
d89d394e04 chore(release): 4.12.1 [skip ci]
## [4.12.1](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.12.0...v4.12.1) (2026-03-24)

### Bug Fixes

* ignore "EditorOnly" tagged gameObjects on refresh ([031d46a](031d46a321))
2026-03-24 08:53:33 +00:00
mob-sakai
031d46a321 fix: ignore "EditorOnly" tagged gameObjects on refresh 2026-03-24 17:53:01 +09:00
semantic-release-bot
af0e98239b chore(release): 4.12.0 [skip ci]
# [4.12.0](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.11.4...v4.12.0) (2026-03-24)

### Features

* explicit null checks ([5384f61](5384f61c56))
2026-03-24 08:34:58 +00:00
mob-sakai
5384f61c56 feat: explicit null checks 2026-03-24 17:32:31 +09:00
mob-sakai
a92d0b9280 Merge remote-tracking branch 'origin/develop' into develop-preview
# Conflicts:
#	Packages/src/CHANGELOG.md
#	Packages/src/package.json
2025-12-24 20:18:34 +09:00
semantic-release-bot
fed927559f chore(release): 4.11.4 [skip ci]
## [4.11.4](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.11.3...v4.11.4) (2025-12-24)

### Bug Fixes

* add early return for case where subEmitter module is disabled ([d1386a1](d1386a1221))
* avoid endless loop ([eb2e862](eb2e862e80)), closes [#392](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/392)
2025-12-24 11:17:10 +00:00
mob-sakai
eb2e862e80 fix: avoid endless loop
close #392
2025-12-24 20:10:01 +09:00
mob-sakai
d1386a1221 fix: add early return for case where subEmitter module is disabled 2025-12-05 09:58:23 +09:00
mob-sakai
a79ffb2c2b fix: fix URL link in README 2025-10-14 20:58:00 +09:00
mob-sakai
37fb189d72 Merge branch 'develop' into develop-preview
# Conflicts:
#	.github/workflows/release.yml
#	Packages/src/CHANGELOG.md
#	Packages/src/README.md
#	Packages/src/package.json
2025-10-14 20:55:52 +09:00
semantic-release-bot
9d56c94636 chore(release): 4.11.3 [skip ci]
## [4.11.3](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.11.2...v4.11.3) (2025-10-14)

### Bug Fixes

* fix icon ([a9461ec](a9461ecb4d))
* fix URL link in README ([1c8c65d](1c8c65d25e)), closes [#376](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/376)
* fix: second and subsequent bursts not displayed when world simulation and non-looping ([df2f3ca](df2f3caafb)), closes [#326](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/326)
* UIParticle in canvas with 0f-0.01f alpha value does not start to play until alpha value is greater than 0.01f, causes play calls to be delayed unintentionally if canvas alpha value is set to mentioned value range ([38aec2e](38aec2ea1a))
2025-10-14 11:53:52 +00:00
mob-sakai
fe179c0f0f chore: update workflow 2025-10-14 19:47:54 +09:00
mob-sakai
df2f3caafb fix: fix: second and subsequent bursts not displayed when world simulation and non-looping
close #326
2025-10-14 19:43:29 +09:00
mob-sakai
1c8c65d25e fix: fix URL link in README
close #376
2025-08-08 17:57:40 +09:00
mob-sakai
a9461ecb4d fix: fix icon 2025-06-14 09:41:44 +09:00
Serkan Şenkal
38aec2ea1a fix: UIParticle in canvas with 0f-0.01f alpha value does not start to play until alpha value is greater than 0.01f, causes play calls to be delayed unintentionally if canvas alpha value is set to mentioned value range 2025-04-09 02:59:26 +09:00
semantic-release-bot
9523ae12c0 chore(release): 5.0.0-preview.16 [skip ci]
# [5.0.0-preview.16](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/5.0.0-preview.15...5.0.0-preview.16) (2025-03-15)

### Bug Fixes

* IL2CPP build fails on older versions of Unity ([0da6525](0da652520c))
* NRE on enable ([0cff50e](0cff50ef69)), closes [#359](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/359)
2025-03-15 08:12:51 +00:00
mob-sakai
96106370e5 Merge remote-tracking branch 'origin/develop' into develop-preview
# Conflicts:
#	Packages/src/CHANGELOG.md
#	Packages/src/package.json
2025-03-15 17:02:36 +09:00
semantic-release-bot
bb2d588e0c chore(release): 4.11.2 [skip ci]
## [4.11.2](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v4.11.1...v4.11.2) (2025-03-15)

### Bug Fixes

* IL2CPP build fails on older versions of Unity ([0da6525](0da652520c))
* NRE on enable ([0cff50e](0cff50ef69)), closes [#359](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/359)
2025-03-15 07:59:37 +00:00
mob-sakai
078005a1a7 chore: fix NanoMonitor link url 2025-03-15 16:58:52 +09:00
mob-sakai
0cff50ef69 fix: NRE on enable
close #359
2025-03-14 19:44:02 +09:00
mob-sakai
0da652520c fix: IL2CPP build fails on older versions of Unity 2025-03-14 19:29:41 +09:00
mob-sakai
4199492e3a chore: update internal 2025-03-14 19:29:22 +09:00
mob-sakai
1f88bb255e chore: fix settings icon 2025-03-14 19:24:22 +09:00
32 changed files with 155 additions and 2594 deletions

View File

@@ -10,6 +10,7 @@ env:
MINIMUM_VERSION: 2019.4
# EXCLUDE_FILTER: The excluded versions of Unity.
EXCLUDE_FILTER: "(2020.2.0|2021.1|2023.3)"
PROJECT_PATH: .
on:
workflow_dispatch:
@@ -21,7 +22,7 @@ on:
push:
branches:
- develop
- develop-preview
- "develop-*"
tags:
- "!*"
paths-ignore:
@@ -71,11 +72,11 @@ jobs:
steps:
- name: 🚚 Checkout ($${{ github.ref }})
if: github.event_name == 'push'
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: 🚚 Checkout pull request (pull_request_target)
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
@@ -85,25 +86,27 @@ jobs:
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git merge origin/${{ github.event.pull_request.base.ref }} --no-edit
git rebase ${{ github.event.pull_request.base.sha }}
git log --oneline -n 10
- name: 📥 Cache library
uses: actions/cache@v4
with:
path: Library
key: Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
path: ${{ env.PROJECT_PATH }}/Library
key: ${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-${{ github.event.pull_request.head.sha || github.sha }}
restore-keys: |
Library-${{ matrix.unityVersion }}-
Library-
${{ env.PROJECT_PATH }}-Library-${{ matrix.unityVersion }}-
${{ env.PROJECT_PATH }}-Library-
- name: 🛠️ Build Unity Project (Test)
uses: game-ci/unity-builder@v4
uses: game-ci/unity-builder@main
timeout-minutes: 45
with:
customImage: ghcr.io/mob-sakai/unity3d:${{ matrix.unityVersion }}
targetPlatform: StandaloneLinux64
allowDirtyBuild: true
customParameters: -nographics
projectPath: ${{ env.PROJECT_PATH }}
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
@@ -118,6 +121,7 @@ jobs:
customParameters: -nographics
checkName: ${{ matrix.unityVersion }} Test Results
githubToken: ${{ github.token }}
projectPath: ${{ env.PROJECT_PATH }}
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}

View File

@@ -18,11 +18,12 @@ MonoBehaviour:
m_EnabledInEditor: 1
m_AlwaysIncludeAssembly: 1
m_InstantiateOnLoad: 1
m_Prefab: {fileID: 7211429669315726685, guid: b73940fc30a2f4eb9a73783e9c1f8da6,
m_Prefab: {fileID: 4567906826058368312, guid: 7cebff2d255b9433cbe23b243c193329,
type: 3}
m_Interval: 0.5
m_Anchor: 0
m_Width: 750
m_HelpUrl: https://github.com/mob-sakai/ParticleEffectForUGUI
m_CustomMonitorItems:
- m_Format: Screen:{0}x{1}
m_Arg0:

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: b73940fc30a2f4eb9a73783e9c1f8da6
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -10,7 +10,7 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f22a23b9d98e440478697f4adf30e61c, type: 3}
m_Name: UIParticle
m_Name: UIParticleProjectSettings
m_EditorClassIdentifier:
m_EnableLinearToGamma: 1
m_HideGeneratedObjects: 1

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 4b9df7b8a4193489299b8f477348ae0c
guid: a5b9278dfbd194d04b1c6ae7031928c1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000

View File

@@ -1,16 +1,21 @@
using System.Collections;
using Coffee.UIParticleInternal;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.TestTools;
namespace Coffee.UIParticle.Editor.Tests
{
public class NewTestScript
{
// A Test behaves as an ordinary method
[Test]
public void NewTestScriptSimplePasses()
[TestCase(-1)]
[TestCase(0)]
[TestCase(2048)]
[TestCase(3000)]
public void GetParticleArray(int requiredSize)
{
// Use the Assert class to test conditions
var array = ParticleSystemExtensions.GetParticleArray(requiredSize);
Debug.Log($"requiredSize: {requiredSize}, array.Length: {array.Length}");
}
// A UnityTest behaves like a coroutine in Play Mode. In Edit Mode you can use

View File

@@ -5,14 +5,14 @@
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "52987fb6e66e7fc48498d8d164c3c8808de4de6b"
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
},
"com.coffee.minimal-resource": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/MinimalResource",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "52987fb6e66e7fc48498d8d164c3c8808de4de6b"
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
},
"com.coffee.nano-monitor": {
"version": "https://github.com/mob-sakai/Coffee.Internal.git?path=Packages/NanoMonitor",
@@ -21,7 +21,7 @@
"dependencies": {
"com.unity.ugui": "1.0.0"
},
"hash": "52987fb6e66e7fc48498d8d164c3c8808de4de6b"
"hash": "3c280f1a8f4db5038b881ff07f270efd9638fa31"
},
"com.coffee.ui-particle": {
"version": "file:src",

View File

@@ -1,3 +1,11 @@
# [5.0.0-preview.16](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/5.0.0-preview.15...5.0.0-preview.16) (2025-03-15)
### Bug Fixes
* IL2CPP build fails on older versions of Unity ([0da6525](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/0da652520cd165b43de7404c0b0ab1fbcf9349d1))
* NRE on enable ([0cff50e](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/0cff50ef696aa53fb7c46a9a737b7cf3a05b7b9b)), closes [#359](https://github.com/mob-sakai/ParticleEffectForUGUI/issues/359)
# [5.0.0-preview.15](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/5.0.0-preview.14...5.0.0-preview.15) (2025-02-21)

View File

@@ -76,7 +76,7 @@ namespace Coffee.UIExtensions
for (var j = 0; j < mats.Count; j++)
{
var mat = mats[j];
if (!mat || !mat.shader) continue;
if (mat == null || mat.shader == null) continue;
for (var i = 0; i < ShaderUtil.GetPropertyCount(mat.shader); i++)
{

View File

@@ -107,7 +107,7 @@ namespace Coffee.UIExtensions
{
var ps = sp.GetArrayElementAtIndex(index).objectReferenceValue as ParticleSystem;
var materialCount = 0;
if (ps && ps.TryGetComponent<ParticleSystemRenderer>(out var psr))
if (ps != null && ps.TryGetComponent<ParticleSystemRenderer>(out var psr))
{
materialCount = psr.sharedMaterials.Length;
}
@@ -121,7 +121,7 @@ namespace Coffee.UIExtensions
var p = sp.GetArrayElementAtIndex(index);
EditorGUI.ObjectField(rect, p, GUIContent.none);
var ps = p.objectReferenceValue as ParticleSystem;
if (!ps || !ps.TryGetComponent<ParticleSystemRenderer>(out var psr)) return;
if (ps == null || !ps.TryGetComponent<ParticleSystemRenderer>(out var psr)) return;
rect.x += 15;
rect.width -= 15;
@@ -188,7 +188,7 @@ namespace Coffee.UIExtensions
public override void OnInspectorGUI()
{
var current = target as UIParticle;
if (!current) return;
if (current == null) return;
Profiler.BeginSample("(UIP:E) OnInspectorGUI");
serializedObject.Update();
@@ -264,7 +264,7 @@ namespace Coffee.UIExtensions
Profiler.BeginSample("(UIP:E) Non-UI built-in shader is not supported.");
foreach (var mat in s_TempMaterials)
{
if (!mat || !mat.shader) continue;
if (mat == null || mat.shader == null) continue;
var shader = mat.shader;
if (IsBuiltInObject(shader) && !shader.name.StartsWith("UI/"))
{
@@ -283,7 +283,7 @@ namespace Coffee.UIExtensions
{
foreach (var mat in s_TempMaterials)
{
if (!mat || !mat.shader) continue;
if (mat == null || mat.shader == null) continue;
var shader = mat.shader;
if (!s_Shaders.Add(shader)) continue;

View File

Before

Width:  |  Height:  |  Size: 418 B

After

Width:  |  Height:  |  Size: 418 B

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7a55e246f37df405bac88eac692e3a86
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -146,7 +146,7 @@ _This package requires **Unity 2019.3 or later**._
### Install as Embedded Package
1. Download the `Source code (zip)` file from [Releases](https://github.com/mob-sakai/SoftMaskForUGUI/releases) and
1. Download the `Source code (zip)` file from [Releases](https://github.com/mob-sakai/ParticleEffectForUGUI/releases) and
extract it.
2. Move the `<extracted_dir>/Packages/src` directory into your project's `Packages` directory.
![](https://github.com/user-attachments/assets/187cbcbe-5922-4ed5-acec-cf19aa17d208)

View File

@@ -38,7 +38,7 @@ namespace Coffee.UIParticleInternal
private static void GetComponentsInChildren_Internal<T>(this Component self, List<T> results, int depth)
where T : Component
{
if (!self || results == null || depth < 0) return;
if (self == null || results == null || depth < 0) return;
var tr = self.transform;
if (tr.TryGetComponent<T>(out var t))
@@ -59,7 +59,7 @@ namespace Coffee.UIParticleInternal
/// </summary>
public static T GetOrAddComponent<T>(this Component self) where T : Component
{
if (!self) return null;
if (self == null) return null;
return self.TryGetComponent<T>(out var component)
? component
: self.gameObject.AddComponent<T>();
@@ -166,7 +166,7 @@ namespace Coffee.UIParticleInternal
#if !UNITY_2021_2_OR_NEWER && !UNITY_2020_3_45 && !UNITY_2020_3_46 && !UNITY_2020_3_47 && !UNITY_2020_3_48
public static T GetComponentInParent<T>(this Component self, bool includeInactive) where T : Component
{
if (!self) return null;
if (self == null) return null;
if (!includeInactive) return self.GetComponentInParent<T>();
var current = self.transform;
@@ -184,9 +184,9 @@ namespace Coffee.UIParticleInternal
/// <summary>
/// Verify whether it can be converted to the specified component.
/// </summary>
internal static bool CanConvertTo<T>(this Object context) where T : MonoBehaviour
internal static bool CanConvertTo<T>(this Object context) where T : MonoBehaviour
{
return context && context.GetType() != typeof(T);
return context != null && context.GetType() != typeof(T);
}
/// <summary>

View File

@@ -32,10 +32,10 @@ namespace Coffee.UIParticleInternal
/// </summary>
public static Texture2D GetActualTexture(this Sprite self)
{
if (!self) return null;
if (self == null) return null;
var ret = s_GetActiveAtlasTextureMethod(self);
return ret ? ret : self.texture;
return ret != null ? ret : self.texture;
}
/// <summary>
@@ -43,7 +43,7 @@ namespace Coffee.UIParticleInternal
/// </summary>
public static SpriteAtlas GetActiveAtlas(this Sprite self)
{
if (!self) return null;
if (self == null) return null;
return s_GetActiveAtlasMethod(self);
}
@@ -53,7 +53,7 @@ namespace Coffee.UIParticleInternal
/// </summary>
internal static Texture2D GetActualTexture(this Sprite self)
{
return self ? self.texture : null;
return self != null ? self.texture : null;
}
#endif
}

View File

@@ -37,7 +37,7 @@ namespace Coffee.UIParticleInternal
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
{
var defaultSettings = GetDefaultSettings(t);
if (!defaultSettings)
if (defaultSettings == null)
{
// When create a new instance, automatically set it as default settings.
defaultSettings = CreateInstance(t) as PreloadedProjectSettings;
@@ -48,7 +48,7 @@ namespace Coffee.UIParticleInternal
SetDefaultSettings(defaultSettings);
}
if (defaultSettings)
if (defaultSettings != null)
{
defaultSettings.OnInitialize();
}
@@ -66,7 +66,7 @@ namespace Coffee.UIParticleInternal
private static Object[] GetPreloadedSettings(Type type)
{
return PlayerSettings.GetPreloadedAssets()
.Where(x => x && x.GetType() == type)
.Where(x => x != null && x.GetType() == type)
.ToArray();
}
@@ -76,12 +76,12 @@ namespace Coffee.UIParticleInternal
?? AssetDatabase.FindAssets($"t:{nameof(PreloadedProjectSettings)}")
.Select(AssetDatabase.GUIDToAssetPath)
.Select(AssetDatabase.LoadAssetAtPath<PreloadedProjectSettings>)
.FirstOrDefault(x => x && x.GetType() == type);
.FirstOrDefault(x => x != null && x.GetType() == type);
}
protected static void SetDefaultSettings(PreloadedProjectSettings asset)
{
if (!asset) return;
if (asset == null) return;
var type = asset.GetType();
if (string.IsNullOrEmpty(AssetDatabase.GetAssetPath(asset)))
@@ -103,7 +103,7 @@ namespace Coffee.UIParticleInternal
var preloadedAssets = PlayerSettings.GetPreloadedAssets();
var projectSettings = GetPreloadedSettings(type);
PlayerSettings.SetPreloadedAssets(preloadedAssets
.Where(x => x)
.Where(x => x != null)
.Except(projectSettings.Except(new[] { asset }))
.Append(asset)
.Distinct()
@@ -133,19 +133,19 @@ namespace Coffee.UIParticleInternal
#if UNITY_EDITOR
private string _jsonText;
public static bool hasInstance => s_Instance;
public static bool hasInstance => s_Instance != null;
public static T instance
{
get
{
if (s_Instance) return s_Instance;
if (s_Instance != null) return s_Instance;
s_Instance = GetDefaultSettings(typeof(T)) as T;
if (s_Instance) return s_Instance;
if (s_Instance != null) return s_Instance;
s_Instance = CreateInstance<T>();
if (!s_Instance)
if (s_Instance == null)
{
s_Instance = null;
return s_Instance;
@@ -174,7 +174,7 @@ namespace Coffee.UIParticleInternal
}
}
#else
public static T instance => s_Instance ? s_Instance : s_Instance = CreateInstance<T>();
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
#endif
/// <summary>
@@ -183,7 +183,7 @@ namespace Coffee.UIParticleInternal
protected virtual void OnEnable()
{
#if UNITY_EDITOR
var isDefaultSettings = !s_Instance || s_Instance == this || GetDefaultSettings(typeof(T)) == this;
var isDefaultSettings = s_Instance == null || s_Instance == this || GetDefaultSettings(typeof(T)) == this;
if (!isDefaultSettings)
{
DestroyImmediate(this, true);
@@ -193,7 +193,7 @@ namespace Coffee.UIParticleInternal
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
#endif
if (s_Instance) return;
if (s_Instance != null) return;
s_Instance = this as T;
}
@@ -222,7 +222,7 @@ namespace Coffee.UIParticleInternal
public override void OnGUI(string searchContext)
{
if (!_target)
if (_target == null)
{
if (_editor)
{

View File

@@ -48,7 +48,7 @@ namespace Coffee.UIParticleInternal
public static void LogIf(bool enable, object tag, object message, Object context = null)
{
if (!enable) return;
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
Log_Internal(LogType.Log, tag, message, context != null ? context : tag as Object);
}
#if !ENABLE_COFFEE_LOGGER
@@ -56,7 +56,7 @@ namespace Coffee.UIParticleInternal
#endif
public static void Log(object tag, object message, Object context = null)
{
Log_Internal(LogType.Log, tag, message, context ? context : tag as Object);
Log_Internal(LogType.Log, tag, message, context != null ? context : tag as Object);
}
#if !ENABLE_COFFEE_LOGGER
@@ -64,13 +64,13 @@ namespace Coffee.UIParticleInternal
#endif
public static void LogWarning(object tag, object message, Object context = null)
{
Log_Internal(LogType.Warning, tag, message, context ? context : tag as Object);
Log_Internal(LogType.Warning, tag, message, context != null ? context : tag as Object);
}
public static void LogError(object tag, object message, Object context = null)
{
#if ENABLE_COFFEE_LOGGER
Log_Internal(LogType.Error, tag, message, context ? context : tag as Object);
Log_Internal(LogType.Error, tag, message, context != null ? context : tag as Object);
#else
Debug.LogError($"{tag}: {message}", context);
#endif

View File

@@ -29,7 +29,7 @@ namespace Coffee.UIParticleInternal
public static void Destroy(Object obj)
{
if (!obj) return;
if (obj == null) return;
#if UNITY_EDITOR
if (!Application.isPlaying)
{
@@ -44,7 +44,7 @@ namespace Coffee.UIParticleInternal
public static void DestroyImmediate(Object obj)
{
if (!obj) return;
if (obj == null) return;
#if UNITY_EDITOR
if (Application.isEditor)
{
@@ -61,7 +61,7 @@ namespace Coffee.UIParticleInternal
public static void SetDirty(Object obj)
{
#if UNITY_EDITOR
if (!obj) return;
if (obj == null) return;
EditorUtility.SetDirty(obj);
#endif
}
@@ -117,11 +117,11 @@ namespace Coffee.UIParticleInternal
foreach (var type in types)
{
var script = scripts.FirstOrDefault(x => x.GetClass() == type);
if (!script) continue;
if (script == null) continue;
var path = type.GetCustomAttribute<IconAttribute>()?._path;
var icon = AssetDatabase.LoadAssetAtPath<Texture2D>(path);
if (!icon) continue;
if (icon == null) continue;
s_SetIconForObject(script, icon);
}

View File

@@ -90,7 +90,7 @@ namespace Coffee.UIParticleInternal
Profiler.BeginSample("(COF)[ObjectRepository] GetFromCache");
if (_cache.TryGetValue(hash, out var entry))
{
if (!entry.storedObject)
if (entry.storedObject == null)
{
Release(ref entry.storedObject);
Profiler.EndSample();
@@ -116,7 +116,7 @@ namespace Coffee.UIParticleInternal
private void Add(Hash128 hash, ref T obj, T newObject)
{
if (!newObject)
if (newObject == null)
{
Release(ref obj);
obj = newObject;
@@ -151,7 +151,7 @@ namespace Coffee.UIParticleInternal
&& _cache.TryGetValue(hash, out var entry))
{
entry.reference--;
if (entry.reference <= 0 || !entry.storedObject)
if (entry.reference <= 0 || entry.storedObject == null)
{
Remove(entry);
}
@@ -192,7 +192,7 @@ namespace Coffee.UIParticleInternal
public void Release(Action<T> onRelease)
{
reference = 0;
if (storedObject)
if (storedObject != null)
{
onRelease?.Invoke(storedObject);
}

View File

@@ -9,6 +9,7 @@ using UnityEngine.Serialization;
using Random = UnityEngine.Random;
[assembly: InternalsVisibleTo("Coffee.UIParticle.Editor")]
[assembly: InternalsVisibleTo("Coffee.UIParticle.Editor.Tests")]
[assembly: InternalsVisibleTo("Coffee.UIParticle.PerformanceDemo")]
[assembly: InternalsVisibleTo("Coffee.UIParticle.Demo")]
@@ -17,7 +18,7 @@ namespace Coffee.UIExtensions
/// <summary>
/// Render maskable and sortable particle effect ,without Camera, RenderTexture or Canvas.
/// </summary>
[Icon("Packages/com.coffee.ui-particle/Icons/UIParticleIcon.png")]
[Icon("Packages/com.coffee.ui-particle/Editor/UIParticleIcon.png")]
[ExecuteAlways]
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasRenderer))]
@@ -512,7 +513,7 @@ namespace Coffee.UIExtensions
for (var i = 0; i < _renderers.Count; i++)
{
var r = _renderers[i];
if (!r || !r.material) continue;
if (r == null || r.material == null) continue;
result.Add(r.material);
}
}
@@ -530,7 +531,7 @@ namespace Coffee.UIExtensions
/// </summary>
public void SetParticleSystemInstance(GameObject instance, bool destroyOldParticles)
{
if (!instance) return;
if (instance == null) return;
var childCount = transform.childCount;
for (var i = 0; i < childCount; i++)
@@ -559,7 +560,7 @@ namespace Coffee.UIExtensions
/// </summary>
public void SetParticleSystemPrefab(GameObject prefab)
{
if (!prefab) return;
if (prefab == null) return;
SetParticleSystemInstance(Instantiate(prefab.gameObject), true);
}
@@ -579,12 +580,14 @@ namespace Coffee.UIExtensions
/// </summary>
private void RefreshParticles(GameObject root)
{
if (!root) return;
if (root == null) return;
root.GetComponentsInChildren(true, particles);
for (var i = particles.Count - 1; 0 <= i; i--)
{
var ps = particles[i];
if (!ps || ps.GetComponentInParent<UIParticle>(true) != this)
if (!ps
|| ps.gameObject.CompareTag("EditorOnly") // Ignore "EditorOnly" tagged ParticleSystems.
|| ps.GetComponentInParent<UIParticle>(true) != this) // Ignore ParticleSystems that are not under this UIParticle.
{
particles.RemoveAt(i);
}
@@ -632,7 +635,7 @@ namespace Coffee.UIExtensions
for (var i = 0; i < particleSystems.Count; i++)
{
var ps = particleSystems[i];
if (!ps) continue;
if (ps == null) continue;
var mainEmitter = ps.GetMainEmitter(particleSystems);
GetRenderer(j++).Set(this, ps, false, mainEmitter);
@@ -683,7 +686,7 @@ namespace Coffee.UIExtensions
for (var i = 0; i < _renderers.Count; i++)
{
var r = _renderers[i];
if (r) continue;
if (r != null) continue;
RefreshParticles(particles);
break;
@@ -693,7 +696,7 @@ namespace Coffee.UIExtensions
for (var i = 0; i < _renderers.Count; i++)
{
var r = _renderers[i];
if (!r) continue;
if (r == null) continue;
r.UpdateMesh(bakeCamera);
}
@@ -711,7 +714,7 @@ namespace Coffee.UIExtensions
for (var i = 0; i < _renderers.Count; i++)
{
var r = _renderers[i];
if (!r) continue;
if (r == null) continue;
r.maskable = maskable;
r.SetMaterialDirty();
}
@@ -724,7 +727,7 @@ namespace Coffee.UIExtensions
_renderers.Add(UIParticleRenderer.AddRenderer(this, index));
}
if (!_renderers[index])
if (_renderers[index] == null)
{
_renderers[index] = UIParticleRenderer.AddRenderer(this, index);
}
@@ -734,13 +737,13 @@ namespace Coffee.UIExtensions
private Camera GetBakeCamera()
{
if (!canvas) return Camera.main;
if (canvas == null) return Camera.main;
if (!useCustomView && canvas.renderMode != RenderMode.ScreenSpaceOverlay && canvas.rootCanvas.worldCamera)
{
return canvas.rootCanvas.worldCamera;
}
if (_bakeCamera)
if (_bakeCamera != null)
{
_bakeCamera.orthographicSize = useCustomView ? customViewSize : 10;
return _bakeCamera;
@@ -759,7 +762,7 @@ namespace Coffee.UIExtensions
}
// Create baking camera.
if (!_bakeCamera)
if (_bakeCamera == null)
{
var go = new GameObject("[generated] UIParticle BakingCamera");
go.SetActive(false);

View File

@@ -208,7 +208,7 @@ namespace Coffee.UIExtensions
private Vector3 GetDestinationPosition(UIParticle uiParticle, ParticleSystem particleSystem)
{
var isUI = uiParticle && uiParticle.enabled;
var isUI = uiParticle != null && uiParticle.enabled;
var psPos = particleSystem.transform.position;
var attractorPos = transform.position;
var dstPos = attractorPos;

View File

@@ -5,7 +5,6 @@ using UnityEngine;
namespace Coffee.UIExtensions
{
[Icon("Packages/com.coffee.ui-particle/Icons/UIParticleIcon.png")]
public class UIParticleProjectSettings : PreloadedProjectSettings<UIParticleProjectSettings>
{
[Header("Setting")]

View File

@@ -5,7 +5,7 @@ MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
icon: {fileID: 2800000, guid: 5f0675613942149309588d556e33d990, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -15,7 +15,7 @@ using UnityEngine.UI;
namespace Coffee.UIExtensions
{
[Icon("Packages/com.coffee.ui-particle/Icons/UIParticleIcon.png")]
[Icon("Packages/com.coffee.ui-particle/Editor/UIParticleIcon.png")]
[ExecuteAlways]
[RequireComponent(typeof(RectTransform))]
[RequireComponent(typeof(CanvasRenderer))]
@@ -55,7 +55,7 @@ namespace Coffee.UIExtensions
s_Corners[1] = transform.TransformPoint(_lastBounds.min.x, _lastBounds.max.y, 0);
s_Corners[2] = transform.TransformPoint(_lastBounds.max.x, _lastBounds.max.y, 0);
s_Corners[3] = transform.TransformPoint(_lastBounds.max.x, _lastBounds.min.y, 0);
if (canvas)
if (canvas != null)
{
var worldToLocalMatrix = canvas.rootCanvas.transform.worldToLocalMatrix;
for (var i = 0; i < 4; ++i)
@@ -95,7 +95,7 @@ namespace Coffee.UIExtensions
{
get
{
if (!_materialForRendering)
if (_materialForRendering == null)
{
_materialForRendering = base.materialForRendering;
}
@@ -106,7 +106,7 @@ namespace Coffee.UIExtensions
public void Reset(int index = -1)
{
if (_renderer)
if (_renderer != null)
{
_renderer.enabled = true;
}
@@ -121,7 +121,7 @@ namespace Coffee.UIExtensions
}
//_emitter = null;
if (this && isActiveAndEnabled)
if (isActiveAndEnabled)
{
material = null;
canvasRenderer.Clear();
@@ -140,7 +140,7 @@ namespace Coffee.UIExtensions
base.OnEnable();
hideFlags = UIParticleProjectSettings.globalHideFlags;
if (!s_CombineInstances[0].mesh)
if (s_CombineInstances[0].mesh == null)
{
s_CombineInstances[0].mesh = new Mesh
{
@@ -283,10 +283,6 @@ namespace Coffee.UIExtensions
|| !transform.lossyScale.GetScaled(_parent.scale3DForCalc).IsVisible() // Scale is not visible.
|| (!_particleSystem.IsAlive() && !_particleSystem.isPlaying) // No particle.
|| (_isTrail && !_particleSystem.trails.enabled) // Trail, but it is not enabled.
#if UNITY_2018_3_OR_NEWER
|| canvasRenderer.GetInheritedAlpha() <
0.01f // #102: Do not bake particle system to mesh when the alpha is zero.
#endif
)
{
Profiler.BeginSample("[UIParticleRenderer] Clear Mesh");
@@ -298,6 +294,24 @@ namespace Coffee.UIExtensions
return;
}
// Reset custom data.
// var customData = _particleSystem.customData;
// if (!customData.enabled || customData.GetMode(ParticleSystemCustomData.Custom1) == ParticleSystemCustomDataMode.Disabled)
// {
// customData.SetVector(ParticleSystemCustomData.Custom1, 0, 0);
// customData.SetVector(ParticleSystemCustomData.Custom1, 1, 0);
// customData.SetVector(ParticleSystemCustomData.Custom1, 2, 0);
// customData.SetVector(ParticleSystemCustomData.Custom1, 3, 0);
// }
//
// if (!customData.enabled || customData.GetMode(ParticleSystemCustomData.Custom2) == ParticleSystemCustomDataMode.Disabled)
// {
// customData.SetVector(ParticleSystemCustomData.Custom2, 0, 0);
// customData.SetVector(ParticleSystemCustomData.Custom2, 1, 0);
// customData.SetVector(ParticleSystemCustomData.Custom2, 2, 0);
// customData.SetVector(ParticleSystemCustomData.Custom2, 3, 0);
// }
var main = _particleSystem.main;
var scale = GetWorldScale();
var psPos = _particleSystem.transform.position;
@@ -315,6 +329,13 @@ namespace Coffee.UIExtensions
#endif
{
ResolveResolutionChange(psPos, scale);
// fix: second and subsequent bursts not displayed when world simulation and non-looping. (#326)
if (!_particleSystem.IsLocalSpace() && !main.loop && _particleSystem.time == 0)
{
_delay = true;
}
Simulate(scale, _parent.isPaused || _delay);
if (_delay && !_parent.isPaused)
@@ -710,7 +731,7 @@ namespace Coffee.UIExtensions
if (s_Mpb.isEmpty) return;
// #41: Copy the value from MaterialPropertyBlock to CanvasRenderer
if (!materialForRendering) return;
if (materialForRendering == null) return;
for (var i = 0; i < _parent.m_AnimatableProperties.Length; i++)
{

View File

@@ -16,25 +16,25 @@ namespace Coffee.UIExtensions
public static void Register(UIParticle particle)
{
if (!particle) return;
if (particle == null) return;
s_ActiveParticles.Add(particle);
}
public static void Unregister(UIParticle particle)
{
if (!particle) return;
if (particle == null) return;
s_ActiveParticles.Remove(particle);
}
public static void Register(UIParticleAttractor attractor)
{
if (!attractor) return;
if (attractor == null) return;
s_ActiveAttractors.Add(attractor);
}
public static void Unregister(UIParticleAttractor attractor)
{
if (!attractor) return;
if (attractor == null) return;
s_ActiveAttractors.Remove(attractor);
}
@@ -71,7 +71,7 @@ namespace Coffee.UIExtensions
for (var i = 0; i < s_ActiveParticles.Count; i++)
{
var uip = s_ActiveParticles[i];
if (!uip || !uip.canvas || !uip.isPrimary || !s_UpdatedGroupIds.Add(uip.groupId)) continue;
if (uip == null || uip.canvas == null || !uip.isPrimary || !s_UpdatedGroupIds.Add(uip.groupId)) continue;
uip.UpdateTransformScale();
uip.UpdateRenderers();
@@ -81,7 +81,7 @@ namespace Coffee.UIExtensions
for (var i = 0; i < s_ActiveParticles.Count; i++)
{
var uip = s_ActiveParticles[i];
if (!uip || !uip.canvas) continue;
if (uip == null || uip.canvas == null) continue;
uip.UpdateTransformScale();
@@ -125,7 +125,7 @@ namespace Coffee.UIExtensions
var uip = s_ActiveParticles[i];
if (!uip.useMeshSharing || uip.groupId != groupId) continue;
if (uip.isPrimary) return uip;
if (!primary && uip.canSimulate) primary = uip;
if (primary == null && uip.canSimulate) primary = uip;
}
return primary;

View File

@@ -13,11 +13,7 @@ namespace Coffee.UIParticleInternal
{
if (s_TmpParticles.Length < size)
{
while (s_TmpParticles.Length < size)
{
size = Mathf.NextPowerOfTwo(size);
}
size = Mathf.NextPowerOfTwo(size);
s_TmpParticles = new ParticleSystem.Particle[size];
}
@@ -88,11 +84,11 @@ namespace Coffee.UIParticleInternal
var bRenderer = b.GetComponent<ParticleSystemRenderer>();
// Render queue: ascending
var aMat = aRenderer.sharedMaterial ? aRenderer.sharedMaterial : aRenderer.trailMaterial;
var bMat = bRenderer.sharedMaterial ? bRenderer.sharedMaterial : bRenderer.trailMaterial;
if (!aMat && !bMat) return 0;
if (!aMat) return -1;
if (!bMat) return 1;
var aMat = aRenderer.sharedMaterial != null ? aRenderer.sharedMaterial : aRenderer.trailMaterial;
var bMat = bRenderer.sharedMaterial != null ? bRenderer.sharedMaterial : bRenderer.trailMaterial;
if (aMat == null && bMat == null) return 0;
if (aMat == null) return -1;
if (bMat == null) return 1;
if (sortByMaterial)
{
@@ -146,7 +142,7 @@ namespace Coffee.UIParticleInternal
public static Texture2D GetTextureForSprite(this ParticleSystem self)
{
if (!self) return null;
if (self == null) return null;
// Get sprite's texture.
var tsaModule = self.textureSheetAnimation;
@@ -155,7 +151,7 @@ namespace Coffee.UIParticleInternal
for (var i = 0; i < tsaModule.spriteCount; i++)
{
var sprite = tsaModule.GetSprite(i);
if (!sprite) continue;
if (sprite == null) continue;
return sprite.GetActualTexture();
}
@@ -167,14 +163,14 @@ namespace Coffee.UIParticleInternal
{
foreach (var p in self)
{
if (!p) continue;
if (p == null) continue;
action.Invoke(p);
}
}
public static ParticleSystem GetMainEmitter(this ParticleSystem self, List<ParticleSystem> list)
{
if (!self || list == null || list.Count == 0) return null;
if (self == null || list == null || list.Count == 0) return null;
for (var i = 0; i < list.Count; i++)
{
@@ -187,7 +183,11 @@ namespace Coffee.UIParticleInternal
public static bool IsSubEmitterOf(this ParticleSystem self, ParticleSystem parent)
{
if (self == null || parent == null) return false;
var subEmitters = parent.subEmitters;
if (!subEmitters.enabled) return false; // No sub emitters.
var count = subEmitters.subEmittersCount;
for (var i = 0; i < count; i++)
{

View File

@@ -15,7 +15,7 @@ namespace Coffee.UIExtensions.Demo
private void Start()
{
if (!m_Origin) return;
if (m_Origin == null) return;
m_Origin.SetActive(false);
var parent = m_Origin.transform.parent;

View File

@@ -42,7 +42,7 @@ public class UIElementDragger : MonoBehaviour, IBeginDragHandler, IDragHandler,
break;
case Target.Custom:
_rectTransform.localPosition += delta;
if (m_CustomTarget)
if (m_CustomTarget != null)
{
if (m_UseCanvasScale)
{

View File

@@ -2,7 +2,7 @@
"name": "com.coffee.ui-particle",
"displayName": "UI Particle",
"description": "This package provides a component to render particle effects for uGUI.\nThe particle rendering is maskable and sortable, without the need for an extra Camera, RenderTexture, or Canvas.",
"version": "5.0.0-preview.15",
"version": "5.0.0-preview.16",
"unity": "2019.3",
"license": "MIT",
"repository": {