diff --git a/Editor/AnimatablePropertyEditor.cs b/Editor/AnimatablePropertyEditor.cs index 9e28284..38bdec9 100644 --- a/Editor/AnimatablePropertyEditor.cs +++ b/Editor/AnimatablePropertyEditor.cs @@ -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++) { diff --git a/Editor/UIParticleEditor.cs b/Editor/UIParticleEditor.cs index 0cffc98..2a06548 100644 --- a/Editor/UIParticleEditor.cs +++ b/Editor/UIParticleEditor.cs @@ -110,7 +110,7 @@ namespace Coffee.UIExtensions { var ps = sp.GetArrayElementAtIndex(index).objectReferenceValue as ParticleSystem; var materialCount = 0; - if (ps && ps.TryGetComponent(out var psr)) + if (ps != null && ps.TryGetComponent(out var psr)) { materialCount = psr.sharedMaterials.Length; } @@ -124,7 +124,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(out var psr)) return; + if (ps == null || !ps.TryGetComponent(out var psr)) return; rect.x += 15; rect.width -= 15; @@ -191,7 +191,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(); @@ -267,7 +267,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/")) { @@ -286,7 +286,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; diff --git a/Runtime/Internal/Extensions/ComponentExtensions.cs b/Runtime/Internal/Extensions/ComponentExtensions.cs index e9ec78b..82314bf 100644 --- a/Runtime/Internal/Extensions/ComponentExtensions.cs +++ b/Runtime/Internal/Extensions/ComponentExtensions.cs @@ -38,7 +38,7 @@ namespace Coffee.UIParticleInternal private static void GetComponentsInChildren_Internal(this Component self, List 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(out var t)) @@ -59,7 +59,7 @@ namespace Coffee.UIParticleInternal /// public static T GetOrAddComponent(this Component self) where T : Component { - if (!self) return null; + if (self == null) return null; return self.TryGetComponent(out var component) ? component : self.gameObject.AddComponent(); @@ -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(this Component self, bool includeInactive) where T : Component { - if (!self) return null; + if (self == null) return null; if (!includeInactive) return self.GetComponentInParent(); var current = self.transform; @@ -184,9 +184,9 @@ namespace Coffee.UIParticleInternal /// /// Verify whether it can be converted to the specified component. /// - internal static bool CanConvertTo(this Object context) where T : MonoBehaviour + internal static bool CanConvertTo(this Object context) where T : MonoBehaviour { - return context && context.GetType() != typeof(T); + return context != null && context.GetType() != typeof(T); } /// diff --git a/Runtime/Internal/Extensions/SpriteExtensions.cs b/Runtime/Internal/Extensions/SpriteExtensions.cs index 9e3d1c2..478805d 100644 --- a/Runtime/Internal/Extensions/SpriteExtensions.cs +++ b/Runtime/Internal/Extensions/SpriteExtensions.cs @@ -32,10 +32,10 @@ namespace Coffee.UIParticleInternal /// 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; } /// @@ -43,7 +43,7 @@ namespace Coffee.UIParticleInternal /// 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 /// internal static Texture2D GetActualTexture(this Sprite self) { - return self ? self.texture : null; + return self != null ? self.texture : null; } #endif } diff --git a/Runtime/Internal/ProjectSettings/PreloadedProjectSettings.cs b/Runtime/Internal/ProjectSettings/PreloadedProjectSettings.cs index 7f5326a..2f469cb 100644 --- a/Runtime/Internal/ProjectSettings/PreloadedProjectSettings.cs +++ b/Runtime/Internal/ProjectSettings/PreloadedProjectSettings.cs @@ -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) - .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(); - 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(); + public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance(); #endif /// @@ -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) { diff --git a/Runtime/Internal/Utilities/Logging.cs b/Runtime/Internal/Utilities/Logging.cs index 1eec46d..12c5b79 100644 --- a/Runtime/Internal/Utilities/Logging.cs +++ b/Runtime/Internal/Utilities/Logging.cs @@ -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 diff --git a/Runtime/Internal/Utilities/Misc.cs b/Runtime/Internal/Utilities/Misc.cs index 4eac3d8..58769e9 100644 --- a/Runtime/Internal/Utilities/Misc.cs +++ b/Runtime/Internal/Utilities/Misc.cs @@ -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()?._path; var icon = AssetDatabase.LoadAssetAtPath(path); - if (!icon) continue; + if (icon == null) continue; s_SetIconForObject(script, icon); } diff --git a/Runtime/Internal/Utilities/ObjectRepository.cs b/Runtime/Internal/Utilities/ObjectRepository.cs index 46213cf..9797789 100644 --- a/Runtime/Internal/Utilities/ObjectRepository.cs +++ b/Runtime/Internal/Utilities/ObjectRepository.cs @@ -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 onRelease) { reference = 0; - if (storedObject) + if (storedObject != null) { onRelease?.Invoke(storedObject); } diff --git a/Runtime/UIParticle.cs b/Runtime/UIParticle.cs index 5c0e4f7..b90a309 100644 --- a/Runtime/UIParticle.cs +++ b/Runtime/UIParticle.cs @@ -471,7 +471,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); } } @@ -489,7 +489,7 @@ namespace Coffee.UIExtensions /// 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++) @@ -518,7 +518,7 @@ namespace Coffee.UIExtensions /// public void SetParticleSystemPrefab(GameObject prefab) { - if (!prefab) return; + if (prefab == null) return; SetParticleSystemInstance(Instantiate(prefab.gameObject), true); } @@ -538,7 +538,7 @@ namespace Coffee.UIExtensions /// 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--) { @@ -591,7 +591,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); @@ -642,7 +642,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; @@ -652,7 +652,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); } @@ -681,7 +681,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(); } @@ -694,7 +694,7 @@ namespace Coffee.UIExtensions _renderers.Add(UIParticleRenderer.AddRenderer(this, index)); } - if (!_renderers[index]) + if (_renderers[index] == null) { _renderers[index] = UIParticleRenderer.AddRenderer(this, index); } @@ -704,13 +704,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; @@ -729,7 +729,7 @@ namespace Coffee.UIExtensions } // Create baking camera. - if (!_bakeCamera) + if (_bakeCamera == null) { var go = new GameObject("[generated] UIParticle BakingCamera"); go.SetActive(false); diff --git a/Runtime/UIParticleAttractor.cs b/Runtime/UIParticleAttractor.cs index 0f5a73f..7cbf248 100644 --- a/Runtime/UIParticleAttractor.cs +++ b/Runtime/UIParticleAttractor.cs @@ -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; diff --git a/Runtime/UIParticleRenderer.cs b/Runtime/UIParticleRenderer.cs index 92cf049..814c137 100644 --- a/Runtime/UIParticleRenderer.cs +++ b/Runtime/UIParticleRenderer.cs @@ -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 { @@ -294,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; @@ -713,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++) { diff --git a/Runtime/UIParticleUpdater.cs b/Runtime/UIParticleUpdater.cs index 2e353e9..d82f485 100644 --- a/Runtime/UIParticleUpdater.cs +++ b/Runtime/UIParticleUpdater.cs @@ -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; diff --git a/Runtime/Utilities/ParticleSystemExtensions.cs b/Runtime/Utilities/ParticleSystemExtensions.cs index 7fec948..ee59b7d 100644 --- a/Runtime/Utilities/ParticleSystemExtensions.cs +++ b/Runtime/Utilities/ParticleSystemExtensions.cs @@ -84,11 +84,11 @@ namespace Coffee.UIParticleInternal var bRenderer = b.GetComponent(); // 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) { @@ -142,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; @@ -151,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(); } @@ -163,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 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++) { @@ -183,7 +183,7 @@ namespace Coffee.UIParticleInternal public static bool IsSubEmitterOf(this ParticleSystem self, ParticleSystem parent) { - if (!self || !parent) return false; + if (self == null || parent == null) return false; var subEmitters = parent.subEmitters; if (!subEmitters.enabled) return false; // No sub emitters. diff --git a/Samples~/Demo/Scripts/CopyItemOnStart.cs b/Samples~/Demo/Scripts/CopyItemOnStart.cs index 0b8af5b..38d667a 100644 --- a/Samples~/Demo/Scripts/CopyItemOnStart.cs +++ b/Samples~/Demo/Scripts/CopyItemOnStart.cs @@ -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; diff --git a/Samples~/Demo/Scripts/UIElementDragger.cs b/Samples~/Demo/Scripts/UIElementDragger.cs index 28d7b3f..bf38fae 100644 --- a/Samples~/Demo/Scripts/UIElementDragger.cs +++ b/Samples~/Demo/Scripts/UIElementDragger.cs @@ -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) {