diff --git a/Assets/Demo/Cartoon FX & War FX Demo/CFX_Demo_With_UIParticle.cs b/Assets/Demo/Cartoon FX & War FX Demo/CFX_Demo_With_UIParticle.cs
index b533dcd..7d2ac3e 100644
--- a/Assets/Demo/Cartoon FX & War FX Demo/CFX_Demo_With_UIParticle.cs
+++ b/Assets/Demo/Cartoon FX & War FX Demo/CFX_Demo_With_UIParticle.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Linq;
using System.Reflection;
using UnityEngine;
diff --git a/Assets/Demo/Performance Demo/Scripts/UIParticle_PerformanceDemo.cs b/Assets/Demo/Performance Demo/Scripts/UIParticle_PerformanceDemo.cs
index ee9fc18..06c1549 100644
--- a/Assets/Demo/Performance Demo/Scripts/UIParticle_PerformanceDemo.cs
+++ b/Assets/Demo/Performance Demo/Scripts/UIParticle_PerformanceDemo.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+using UnityEngine;
using UnityEngine.Serialization;
namespace Coffee.UIExtensions.Demo
diff --git a/Assets/Tests/Editor/NewTestScript.cs b/Assets/Tests/Editor/NewTestScript.cs
index 5f10abf..9de2f92 100644
--- a/Assets/Tests/Editor/NewTestScript.cs
+++ b/Assets/Tests/Editor/NewTestScript.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+using System.Collections;
using NUnit.Framework;
using UnityEngine.TestTools;
diff --git a/Assets/Tests/NewTestScript.cs b/Assets/Tests/NewTestScript.cs
index fbec447..ae00b8d 100644
--- a/Assets/Tests/NewTestScript.cs
+++ b/Assets/Tests/NewTestScript.cs
@@ -1,4 +1,4 @@
-using System.Collections;
+using System.Collections;
using NUnit.Framework;
using UnityEngine.TestTools;
diff --git a/Packages/src/Editor/UIParticleEditor.cs b/Packages/src/Editor/UIParticleEditor.cs
index 3ba75f0..bd5d0c9 100644
--- a/Packages/src/Editor/UIParticleEditor.cs
+++ b/Packages/src/Editor/UIParticleEditor.cs
@@ -1,3 +1,11 @@
+using System.Collections.Generic;
+using System.Linq;
+using System.Text.RegularExpressions;
+using UnityEditor;
+using UnityEditor.UI;
+using UnityEditorInternal;
+using UnityEngine;
+using UnityEngine.UI;
#if UNITY_2021_2_OR_NEWER
using UnityEditor.Overlays;
#else
@@ -8,17 +16,6 @@ using UnityEditor.SceneManagement;
#elif UNITY_2018_3_OR_NEWER
using UnityEditor.Experimental.SceneManagement;
#endif
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
-using Coffee.UIParticleExtensions;
-using UnityEditor;
-using UnityEditor.UI;
-using UnityEditorInternal;
-using UnityEngine;
-using UnityEngine.UI;
-using Object = UnityEngine.Object;
namespace Coffee.UIExtensions
{
@@ -29,9 +26,9 @@ namespace Coffee.UIExtensions
#if UNITY_2021_2_OR_NEWER
#if UNITY_2022_1_OR_NEWER
[Overlay(typeof(SceneView), "Scene View/UI Particles", "UI Particles", true,
- defaultDockPosition = DockPosition.Bottom,
- defaultDockZone = DockZone.Floating,
- defaultLayout = Layout.Panel)]
+ defaultDockPosition = DockPosition.Bottom,
+ defaultDockZone = DockZone.Floating,
+ defaultLayout = Layout.Panel)]
#else
[Overlay(typeof(SceneView), "Scene View/UI Particles", "UI Particles", true)]
#endif
diff --git a/Packages/src/Runtime/AnimatableProperty.cs b/Packages/src/Runtime/AnimatableProperty.cs
index c4d0c08..2793395 100644
--- a/Packages/src/Runtime/AnimatableProperty.cs
+++ b/Packages/src/Runtime/AnimatableProperty.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using UnityEngine;
namespace Coffee.UIExtensions
@@ -19,10 +19,7 @@ namespace Coffee.UIExtensions
[SerializeField] private ShaderPropertyType m_Type = ShaderPropertyType.Vector;
public int id { get; private set; }
- public ShaderPropertyType type
- {
- get { return m_Type; }
- }
+ public ShaderPropertyType type => m_Type;
void ISerializationCallbackReceiver.OnBeforeSerialize()
{
diff --git a/Packages/src/Runtime/ModifiedMaterial.cs b/Packages/src/Runtime/ModifiedMaterial.cs
index fdf3baa..bb65a29 100644
--- a/Packages/src/Runtime/ModifiedMaterial.cs
+++ b/Packages/src/Runtime/ModifiedMaterial.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using UnityEngine;
namespace Coffee.UIParticleExtensions
diff --git a/Packages/src/Runtime/UIParticle.cs b/Packages/src/Runtime/UIParticle.cs
index 2048fd9..e88b106 100644
--- a/Packages/src/Runtime/UIParticle.cs
+++ b/Packages/src/Runtime/UIParticle.cs
@@ -21,6 +21,13 @@ namespace Coffee.UIExtensions
[RequireComponent(typeof(CanvasRenderer))]
public class UIParticle : MaskableGraphic, ISerializationCallbackReceiver
{
+ public enum AutoScalingMode
+ {
+ None,
+ UIParticle,
+ Transform
+ }
+
public enum MeshSharing
{
None,
@@ -36,13 +43,6 @@ namespace Coffee.UIExtensions
Absolute
}
- public enum AutoScalingMode
- {
- None,
- UIParticle,
- Transform
- }
-
[HideInInspector]
[SerializeField]
internal bool m_IsTrail;
@@ -113,7 +113,7 @@ namespace Coffee.UIExtensions
///
public override bool raycastTarget
{
- get { return false; }
+ get => false;
set { }
}
@@ -127,8 +127,8 @@ namespace Coffee.UIExtensions
///
public MeshSharing meshSharing
{
- get { return m_MeshSharing; }
- set { m_MeshSharing = value; }
+ get => m_MeshSharing;
+ set => m_MeshSharing = value;
}
///
@@ -137,7 +137,7 @@ namespace Coffee.UIExtensions
///
public int groupId
{
- get { return _groupId; }
+ get => _groupId;
set
{
if (m_GroupId == value) return;
@@ -151,7 +151,7 @@ namespace Coffee.UIExtensions
public int groupMaxId
{
- get { return m_GroupMaxId; }
+ get => m_GroupMaxId;
set
{
if (m_GroupMaxId == value) return;
@@ -167,8 +167,8 @@ namespace Coffee.UIExtensions
///
public PositionMode positionMode
{
- get { return m_PositionMode; }
- set { m_PositionMode = value; }
+ get => m_PositionMode;
+ set => m_PositionMode = value;
}
///
@@ -178,8 +178,8 @@ namespace Coffee.UIExtensions
///
public bool absoluteMode
{
- get { return m_PositionMode == PositionMode.Absolute; }
- set { positionMode = value ? PositionMode.Absolute : PositionMode.Relative; }
+ get => m_PositionMode == PositionMode.Absolute;
+ set => positionMode = value ? PositionMode.Absolute : PositionMode.Relative;
}
///
@@ -188,11 +188,8 @@ namespace Coffee.UIExtensions
[Obsolete("The autoScaling is now obsolete. Please use the autoScalingMode instead.", false)]
public bool autoScaling
{
- get { return m_AutoScalingMode != AutoScalingMode.None; }
- set
- {
- autoScalingMode = value ? AutoScalingMode.Transform : AutoScalingMode.None;
- }
+ get => m_AutoScalingMode != AutoScalingMode.None;
+ set => autoScalingMode = value ? AutoScalingMode.Transform : AutoScalingMode.None;
}
///
@@ -202,7 +199,7 @@ namespace Coffee.UIExtensions
///
public AutoScalingMode autoScalingMode
{
- get { return m_AutoScalingMode; }
+ get => m_AutoScalingMode;
set
{
if (m_AutoScalingMode == value) return;
@@ -211,49 +208,31 @@ namespace Coffee.UIExtensions
}
}
- internal bool useMeshSharing
- {
- get { return m_MeshSharing != MeshSharing.None; }
- }
+ internal bool useMeshSharing => m_MeshSharing != MeshSharing.None;
- internal bool isPrimary
- {
- get
- {
- return m_MeshSharing == MeshSharing.Primary
- || m_MeshSharing == MeshSharing.PrimarySimulator;
- }
- }
+ internal bool isPrimary =>
+ m_MeshSharing == MeshSharing.Primary
+ || m_MeshSharing == MeshSharing.PrimarySimulator;
- internal bool canSimulate
- {
- get
- {
- return m_MeshSharing == MeshSharing.None
- || m_MeshSharing == MeshSharing.Auto
- || m_MeshSharing == MeshSharing.Primary
- || m_MeshSharing == MeshSharing.PrimarySimulator;
- }
- }
+ internal bool canSimulate =>
+ m_MeshSharing == MeshSharing.None
+ || m_MeshSharing == MeshSharing.Auto
+ || m_MeshSharing == MeshSharing.Primary
+ || m_MeshSharing == MeshSharing.PrimarySimulator;
- internal bool canRender
- {
- get
- {
- return m_MeshSharing == MeshSharing.None
- || m_MeshSharing == MeshSharing.Auto
- || m_MeshSharing == MeshSharing.Primary
- || m_MeshSharing == MeshSharing.Replica;
- }
- }
+ internal bool canRender =>
+ m_MeshSharing == MeshSharing.None
+ || m_MeshSharing == MeshSharing.Auto
+ || m_MeshSharing == MeshSharing.Primary
+ || m_MeshSharing == MeshSharing.Replica;
///
/// Particle effect scale.
///
public float scale
{
- get { return m_Scale3D.x; }
- set { m_Scale3D = new Vector3(value, value, value); }
+ get => m_Scale3D.x;
+ set => m_Scale3D = new Vector3(value, value, value);
}
///
@@ -261,22 +240,18 @@ namespace Coffee.UIExtensions
///
public Vector3 scale3D
{
- get { return m_Scale3D; }
- set { m_Scale3D = value; }
+ get => m_Scale3D;
+ set => m_Scale3D = value;
}
///
/// Particle effect scale.
///
- public Vector3 scale3DForCalc
- {
- get { return autoScalingMode == AutoScalingMode.UIParticle ? m_Scale3D.GetScaled(canvasScale) : m_Scale3D; }
- }
+ public Vector3 scale3DForCalc => autoScalingMode == AutoScalingMode.UIParticle
+ ? m_Scale3D.GetScaled(canvasScale)
+ : m_Scale3D;
- public List particles
- {
- get { return m_Particles; }
- }
+ public List particles => m_Particles;
///
/// Get all base materials to render.
@@ -294,10 +269,7 @@ namespace Coffee.UIExtensions
}
}
- public override Material materialForRendering
- {
- get { return null; }
- }
+ public override Material materialForRendering => null;
///
/// Paused.
@@ -637,7 +609,10 @@ namespace Coffee.UIExtensions
// Create ortho-camera.
if (!_orthoCamera)
{
- var go = new GameObject("[generated] UIParticleOverlayCamera") { hideFlags = HideFlags.HideAndDontSave };
+ var go = new GameObject("[generated] UIParticleOverlayCamera")
+ {
+ hideFlags = HideFlags.HideAndDontSave
+ };
go.SetActive(false);
go.transform.SetParent(transform, false);
_orthoCamera = go.AddComponent();
diff --git a/Packages/src/Runtime/UIParticleAttractor.cs b/Packages/src/Runtime/UIParticleAttractor.cs
index a33c6a3..e412e63 100644
--- a/Packages/src/Runtime/UIParticleAttractor.cs
+++ b/Packages/src/Runtime/UIParticleAttractor.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using Coffee.UIParticleExtensions;
using UnityEngine;
using UnityEngine.Events;
@@ -49,38 +49,38 @@ namespace Coffee.UIExtensions
public float destinationRadius
{
- get { return m_DestinationRadius; }
- set { m_DestinationRadius = Mathf.Clamp(value, 0.1f, 10f); }
+ get => m_DestinationRadius;
+ set => m_DestinationRadius = Mathf.Clamp(value, 0.1f, 10f);
}
public float delay
{
- get { return m_DelayRate; }
- set { m_DelayRate = value; }
+ get => m_DelayRate;
+ set => m_DelayRate = value;
}
public float maxSpeed
{
- get { return m_MaxSpeed; }
- set { m_MaxSpeed = value; }
+ get => m_MaxSpeed;
+ set => m_MaxSpeed = value;
}
public Movement movement
{
- get { return m_Movement; }
- set { m_Movement = value; }
+ get => m_Movement;
+ set => m_Movement = value;
}
public UpdateMode updateMode
{
- get { return m_UpdateMode; }
- set { m_UpdateMode = value; }
+ get => m_UpdateMode;
+ set => m_UpdateMode = value;
}
public UnityEvent onAttracted
{
- get { return m_OnAttracted; }
- set { m_OnAttracted = value; }
+ get => m_OnAttracted;
+ set => m_OnAttracted = value;
}
#if UNITY_EDITOR
diff --git a/Packages/src/Runtime/UIParticleRenderer.cs b/Packages/src/Runtime/UIParticleRenderer.cs
index 65d848d..6abfae1 100644
--- a/Packages/src/Runtime/UIParticleRenderer.cs
+++ b/Packages/src/Runtime/UIParticleRenderer.cs
@@ -1,4 +1,4 @@
-#if UNITY_2022_3_0 || UNITY_2022_3_1 || UNITY_2022_3_2 || UNITY_2022_3_3 || UNITY_2022_3_4 || UNITY_2022_3_5 || UNITY_2022_3_6 || UNITY_2022_3_7 || UNITY_2022_3_8 || UNITY_2022_3_9 || UNITY_2022_3_10
+#if UNITY_2022_3_0 || UNITY_2022_3_1 || UNITY_2022_3_2 || UNITY_2022_3_3 || UNITY_2022_3_4 || UNITY_2022_3_5 || UNITY_2022_3_6 || UNITY_2022_3_7 || UNITY_2022_3_8 || UNITY_2022_3_9 || UNITY_2022_3_10
#elif UNITY_2023_1_0 || UNITY_2023_1_1 || UNITY_2023_1_2 || UNITY_2023_1_3 || UNITY_2023_1_4 || UNITY_2023_1_5 || UNITY_2023_1_6 || UNITY_2023_1_7 || UNITY_2023_1_8 || UNITY_2023_1_9
#elif UNITY_2023_1_10 || UNITY_2023_1_11 || UNITY_2023_1_12 || UNITY_2023_1_13 || UNITY_2023_1_14 || UNITY_2023_1_15 || UNITY_2023_1_16
#elif UNITY_2022_3_OR_NEWER
@@ -36,22 +36,16 @@ namespace Coffee.UIExtensions
private Material _modifiedMaterial;
private UIParticle _parent;
private ParticleSystem _particleSystem;
+ private float _prevCanvasScale;
private Vector3 _prevPsPos;
private Vector3 _prevScale;
private Vector2Int _prevScreenSize;
- private float _prevCanvasScale;
private bool _prewarm;
private ParticleSystemRenderer _renderer;
- public override Texture mainTexture
- {
- get { return _isTrail ? null : _particleSystem.GetTextureForSprite(); }
- }
+ public override Texture mainTexture => _isTrail ? null : _particleSystem.GetTextureForSprite();
- public override bool raycastTarget
- {
- get { return false; }
- }
+ public override bool raycastTarget => false;
private Rect rootCanvasRect
{
@@ -337,7 +331,8 @@ namespace Coffee.UIExtensions
if (_isTrail && _parent.canSimulate && 0 < s_CombineInstances[0].mesh.vertexCount)
{
#if PS_BAKE_API_V2
- _renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera, ParticleSystemBakeMeshOptions.BakeRotationAndScale);
+ _renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera,
+ ParticleSystemBakeMeshOptions.BakeRotationAndScale);
#else
_renderer.BakeTrailsMesh(s_CombineInstances[0].mesh, bakeCamera, true);
#endif
@@ -345,7 +340,8 @@ namespace Coffee.UIExtensions
else if (_renderer.CanBakeMesh())
{
#if PS_BAKE_API_V2
- _renderer.BakeMesh(s_CombineInstances[0].mesh, bakeCamera, ParticleSystemBakeMeshOptions.BakeRotationAndScale);
+ _renderer.BakeMesh(s_CombineInstances[0].mesh, bakeCamera,
+ ParticleSystemBakeMeshOptions.BakeRotationAndScale);
#else
_renderer.BakeMesh(s_CombineInstances[0].mesh, bakeCamera, true);
#endif
@@ -416,6 +412,7 @@ namespace Coffee.UIExtensions
c.b = c.b.LinearToGamma();
s_Colors[i] = c;
}
+
workerMesh.SetColors(s_Colors);
Profiler.EndSample();
}
@@ -470,7 +467,7 @@ namespace Coffee.UIExtensions
SetMaterialDirty();
}
#endif
-
+
UpdateMaterialProperties();
if (_parent.useMeshSharing)
{
diff --git a/Packages/src/Runtime/UIParticleUpdater.cs b/Packages/src/Runtime/UIParticleUpdater.cs
index 63b251d..f316a7e 100644
--- a/Packages/src/Runtime/UIParticleUpdater.cs
+++ b/Packages/src/Runtime/UIParticleUpdater.cs
@@ -11,10 +11,7 @@ namespace Coffee.UIExtensions
private static readonly HashSet s_UpdatedGroupIds = new HashSet();
private static int s_FrameCount;
- public static int uiParticleCount
- {
- get { return s_ActiveParticles.Count; }
- }
+ public static int uiParticleCount => s_ActiveParticles.Count;
public static void Register(UIParticle particle)
{
diff --git a/Packages/src/Runtime/Utils.cs b/Packages/src/Runtime/Utils.cs
index 6700333..36c6444 100644
--- a/Packages/src/Runtime/Utils.cs
+++ b/Packages/src/Runtime/Utils.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Reflection;
using UnityEngine;
diff --git a/Packages/src/Samples~/Demo/Scripts/CopyItemOnStart.cs b/Packages/src/Samples~/Demo/Scripts/CopyItemOnStart.cs
index 04d0d26..0b8af5b 100644
--- a/Packages/src/Samples~/Demo/Scripts/CopyItemOnStart.cs
+++ b/Packages/src/Samples~/Demo/Scripts/CopyItemOnStart.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+using UnityEngine;
using UnityEngine.Serialization;
namespace Coffee.UIExtensions.Demo
diff --git a/Packages/src/Samples~/Demo/Scripts/UIElementDragger.cs b/Packages/src/Samples~/Demo/Scripts/UIElementDragger.cs
index 9dbdeda..28d7b3f 100644
--- a/Packages/src/Samples~/Demo/Scripts/UIElementDragger.cs
+++ b/Packages/src/Samples~/Demo/Scripts/UIElementDragger.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
diff --git a/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo.cs b/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo.cs
index dca4311..357b5bc 100644
--- a/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo.cs
+++ b/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UI;
diff --git a/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo_UIParticleController.cs b/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo_UIParticleController.cs
index 21730a0..e9ccde1 100644
--- a/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo_UIParticleController.cs
+++ b/Packages/src/Samples~/Demo/Scripts/UIParticle_Demo_UIParticleController.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+using UnityEngine;
using UnityEngine.Serialization;
namespace Coffee.UIExtensions.Demo