diff --git a/Editor/UIParticleEditor.cs b/Editor/UIParticleEditor.cs index c58924f..0cffc98 100644 --- a/Editor/UIParticleEditor.cs +++ b/Editor/UIParticleEditor.cs @@ -62,6 +62,7 @@ namespace Coffee.UIExtensions private SerializedProperty _autoScalingMode; private SerializedProperty _useCustomView; private SerializedProperty _customViewSize; + private SerializedProperty _timeScaleMultiplier; private ReorderableList _ro; private bool _showMax; private bool _is3DScaleMode; @@ -100,6 +101,7 @@ namespace Coffee.UIExtensions _autoScalingMode = serializedObject.FindProperty("m_AutoScalingMode"); _useCustomView = serializedObject.FindProperty("m_UseCustomView"); _customViewSize = serializedObject.FindProperty("m_CustomViewSize"); + _timeScaleMultiplier = serializedObject.FindProperty("m_TimeScaleMultiplier"); var sp = serializedObject.FindProperty("m_Particles"); _ro = new ReorderableList(sp.serializedObject, sp, true, true, true, true) @@ -244,6 +246,9 @@ namespace Coffee.UIExtensions _customViewSize.floatValue = Mathf.Max(0.1f, _customViewSize.floatValue); } + // Time Scale Multiplier + EditorGUILayout.PropertyField(_timeScaleMultiplier); + // Target ParticleSystems. EditorGUI.BeginChangeCheck(); _ro.DoLayoutList(); diff --git a/Runtime/UIParticle.cs b/Runtime/UIParticle.cs index f0a2bed..354f4df 100644 --- a/Runtime/UIParticle.cs +++ b/Runtime/UIParticle.cs @@ -119,6 +119,10 @@ namespace Coffee.UIExtensions "Change the bake view size.")] private float m_CustomViewSize = 10; + [SerializeField] + [Tooltip("Time scale multiplier.")] + private float m_TimeScaleMultiplier = 1; + private readonly List _renderers = new List(); private Camera _bakeCamera; private int _groupId; @@ -257,6 +261,15 @@ namespace Coffee.UIExtensions set => m_CustomViewSize = Mathf.Max(0.1f, value); } + /// + /// Time scale multiplier. + /// + public float timeScaleMultiplier + { + get => m_TimeScaleMultiplier; + set => m_TimeScaleMultiplier = value; + } + internal bool useMeshSharing => m_MeshSharing != MeshSharing.None; internal bool isPrimary => diff --git a/Runtime/UIParticleRenderer.cs b/Runtime/UIParticleRenderer.cs index a73b4b4..fef02be 100644 --- a/Runtime/UIParticleRenderer.cs +++ b/Runtime/UIParticleRenderer.cs @@ -628,6 +628,7 @@ namespace Coffee.UIExtensions : main.useUnscaledTime ? Time.unscaledDeltaTime : Time.deltaTime; + deltaTime *= _parent.timeScaleMultiplier; // Pre-warm: if (0 < deltaTime && _preWarm)