You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-05-14 20:20:06 +00:00
fix: support sub emitter with 'PlayOnAwake'
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
#if UNITY_2019_3_11 || UNITY_2019_3_12 || UNITY_2019_3_13 || UNITY_2019_3_14 || UNITY_2019_3_15 || UNITY_2019_4_OR_NEWER
|
#if UNITY_2019_3_11 || UNITY_2019_3_12 || UNITY_2019_3_13 || UNITY_2019_3_14 || UNITY_2019_3_15 || UNITY_2019_4_OR_NEWER
|
||||||
#define SERIALIZE_FIELD_MASKABLE
|
#define SERIALIZE_FIELD_MASKABLE
|
||||||
#endif
|
#endif
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using Coffee.UIParticleExtensions;
|
using Coffee.UIParticleExtensions;
|
||||||
@@ -60,6 +61,7 @@ namespace Coffee.UIExtensions
|
|||||||
private static readonly List<Material> s_PrevMaskMaterials = new List<Material>();
|
private static readonly List<Material> s_PrevMaskMaterials = new List<Material>();
|
||||||
private static readonly List<Material> s_PrevModifiedMaterials = new List<Material>();
|
private static readonly List<Material> s_PrevModifiedMaterials = new List<Material>();
|
||||||
private static readonly List<Component> s_Components = new List<Component>();
|
private static readonly List<Component> s_Components = new List<Component>();
|
||||||
|
private static readonly List<ParticleSystem> s_ParticleSystems = new List<ParticleSystem>();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -407,6 +409,22 @@ namespace Coffee.UIExtensions
|
|||||||
InitializeIfNeeded();
|
InitializeIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private new IEnumerator Start()
|
||||||
|
{
|
||||||
|
// #148: Particle Sub Emitter not showing when start game
|
||||||
|
var hasPlayingSubEmitter = particles.AnyFast(ps =>
|
||||||
|
{
|
||||||
|
ps.GetComponentsInChildren(false, s_ParticleSystems);
|
||||||
|
return s_ParticleSystems.AnyFast(p => p.isPlaying && p.subEmitters.enabled);
|
||||||
|
});
|
||||||
|
s_ParticleSystems.Clear();
|
||||||
|
if (!hasPlayingSubEmitter) yield break;
|
||||||
|
|
||||||
|
Stop();
|
||||||
|
yield return null;
|
||||||
|
Play();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function is called when the behaviour becomes disabled.
|
/// This function is called when the behaviour becomes disabled.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -65,6 +65,16 @@ namespace Coffee.UIParticleExtensions
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool AnyFast<T>(this List<T> self, Predicate<T> predicate) where T : Object
|
||||||
|
{
|
||||||
|
for (var i = 0; i < self.Count; ++i)
|
||||||
|
{
|
||||||
|
if (self[i] && predicate(self[i])) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static class MeshExtensions
|
internal static class MeshExtensions
|
||||||
|
|||||||
Reference in New Issue
Block a user