You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-07-02 14:23:43 +00:00
Compare commits
7 Commits
0441238cc5
...
64a050f17c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64a050f17c | ||
|
|
d6d36006ad | ||
|
|
63d5eedde1 | ||
|
|
c05c1d5f21 | ||
|
|
738021a9b3 | ||
|
|
b4cac73fb1 | ||
|
|
32c9926f10 |
@@ -49,7 +49,6 @@ namespace Coffee.UIExtensions
|
|||||||
private static readonly GUIContent s_ContentRandom = new GUIContent("Random");
|
private static readonly GUIContent s_ContentRandom = new GUIContent("Random");
|
||||||
private static readonly GUIContent s_ContentScale = new GUIContent("Scale");
|
private static readonly GUIContent s_ContentScale = new GUIContent("Scale");
|
||||||
private static readonly GUIContent s_ContentPrimary = new GUIContent("Primary");
|
private static readonly GUIContent s_ContentPrimary = new GUIContent("Primary");
|
||||||
private static readonly GUIContent s_Remove = new GUIContent("Remove");
|
|
||||||
private static readonly Regex s_RegexBuiltInGuid = new Regex(@"^0{16}.0{15}$", RegexOptions.Compiled);
|
private static readonly Regex s_RegexBuiltInGuid = new Regex(@"^0{16}.0{15}$", RegexOptions.Compiled);
|
||||||
private static readonly List<Material> s_TempMaterials = new List<Material>();
|
private static readonly List<Material> s_TempMaterials = new List<Material>();
|
||||||
|
|
||||||
@@ -83,6 +82,18 @@ namespace Coffee.UIExtensions
|
|||||||
"_ColorMask"
|
"_ColorMask"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ドメインリロード無効化対応:静的キャッシュをクリア
|
||||||
|
/// </summary>
|
||||||
|
[InitializeOnLoadMethod]
|
||||||
|
private static void OnDomainReload()
|
||||||
|
{
|
||||||
|
s_Shaders.Clear();
|
||||||
|
#if UNITY_2018 || UNITY_2019
|
||||||
|
s_Streams.Clear();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//################################
|
//################################
|
||||||
// Public/Protected Members.
|
// Public/Protected Members.
|
||||||
//################################
|
//################################
|
||||||
|
|||||||
@@ -195,6 +195,13 @@ namespace Coffee.UIParticleInternal
|
|||||||
private static T s_Instance;
|
private static T s_Instance;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
|
private static void OnDomainReload()
|
||||||
|
{
|
||||||
|
s_Instance = null;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
private string _jsonText;
|
private string _jsonText;
|
||||||
|
|
||||||
public static bool hasInstance => s_Instance != null;
|
public static bool hasInstance => s_Instance != null;
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR && UNITY_2019_2_OR_NEWER
|
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
private static void Clear()
|
private static void Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
public static Func<string, Shader> onShaderFind = Shader.Find;
|
public static Func<string, Shader> onShaderFind = Shader.Find;
|
||||||
|
|
||||||
#if UNITY_EDITOR && UNITY_2019_2_OR_NEWER
|
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
public static void Clear()
|
public static void Clear()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -82,14 +82,22 @@ namespace Coffee.UIParticleInternal
|
|||||||
message: "InitializeAfterCanvasRebuild");
|
message: "InitializeAfterCanvasRebuild");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
|
#elif UNITY_EDITOR
|
||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
#endif
|
#else
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||||
|
#endif
|
||||||
private static void InitializeOnLoad()
|
private static void InitializeOnLoad()
|
||||||
{
|
{
|
||||||
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
Canvas.willRenderCanvases -= OnAfterCanvasRebuild;
|
||||||
s_IsInitializedAfterCanvasRebuild = false;
|
s_IsInitializedAfterCanvasRebuild = false;
|
||||||
|
s_AfterCanvasRebuildAction.Clear();
|
||||||
|
s_LateAfterCanvasRebuildAction.Clear();
|
||||||
|
s_BeforeCanvasRebuildAction.Clear();
|
||||||
|
s_OnScreenSizeChangedAction.Clear();
|
||||||
|
s_LastScreenSize = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
_gameObjects = targets.OfType<ParticleSystemPreviewer>().Select(x => x.gameObject).ToArray();
|
_gameObjects = targets.OfType<ParticleSystemPreviewer>().Select(x => x.gameObject).ToArray();
|
||||||
ParticleSystemPreviewSystem.Register(_gameObjects);
|
ParticleSystemPreviewSystem.Register(_gameObjects);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
@@ -47,6 +46,19 @@ namespace Coffee.UIExtensions
|
|||||||
[SerializeField]
|
[SerializeField]
|
||||||
private List<GameObject> m_PreviewObjects = new List<GameObject>();
|
private List<GameObject> m_PreviewObjects = new List<GameObject>();
|
||||||
|
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
|
#else
|
||||||
|
[InitializeOnLoadMethod]
|
||||||
|
#endif
|
||||||
|
public static void Initialize()
|
||||||
|
{
|
||||||
|
instance.OnSelectionChanged();
|
||||||
|
|
||||||
|
Selection.selectionChanged -= instance.OnSelectionChanged;
|
||||||
|
Selection.selectionChanged += instance.OnSelectionChanged;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adds a temporary ParticleSystem to the specified GameObject for preview purposes.
|
/// Adds a temporary ParticleSystem to the specified GameObject for preview purposes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -66,25 +78,18 @@ namespace Coffee.UIExtensions
|
|||||||
if (!target) return;
|
if (!target) return;
|
||||||
if (EditorApplication.isPlaying) return;
|
if (EditorApplication.isPlaying) return;
|
||||||
if (instance.m_PreviewObjects.Contains(target)) return;
|
if (instance.m_PreviewObjects.Contains(target)) return;
|
||||||
if (target.TryGetComponent<ParticleSystem>(out var _)) return;
|
if (target.TryGetComponent<ParticleSystem>(out var ps))
|
||||||
|
|
||||||
// Create temporary ParticleSystem for preview.
|
|
||||||
var ps = target.AddComponent<ParticleSystem>();
|
|
||||||
ps.hideFlags = k_TemporaryHideFlags;
|
|
||||||
|
|
||||||
var emission = ps.emission;
|
|
||||||
emission.enabled = false;
|
|
||||||
var shape = ps.shape;
|
|
||||||
shape.enabled = false;
|
|
||||||
|
|
||||||
if (target.TryGetComponent<ParticleSystemRenderer>(out var psr))
|
|
||||||
{
|
{
|
||||||
psr.enabled = false;
|
if (ps.hideFlags == k_TemporaryHideFlags)
|
||||||
psr.hideFlags = k_TemporaryHideFlags;
|
{
|
||||||
|
RegisterParticleSystem(ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
instance.m_PreviewObjects.Add(target);
|
// Create temporary ParticleSystem for preview.
|
||||||
EditorUtility.SetDirty(target);
|
RegisterParticleSystem(target.AddComponent<ParticleSystem>());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -105,6 +110,26 @@ namespace Coffee.UIExtensions
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void RegisterParticleSystem(ParticleSystem ps)
|
||||||
|
{
|
||||||
|
if (!ps) return;
|
||||||
|
ps.hideFlags = k_TemporaryHideFlags;
|
||||||
|
|
||||||
|
var emission = ps.emission;
|
||||||
|
emission.enabled = false;
|
||||||
|
var shape = ps.shape;
|
||||||
|
shape.enabled = false;
|
||||||
|
|
||||||
|
if (ps.TryGetComponent<ParticleSystemRenderer>(out var psr))
|
||||||
|
{
|
||||||
|
psr.enabled = false;
|
||||||
|
psr.hideFlags = k_TemporaryHideFlags;
|
||||||
|
}
|
||||||
|
|
||||||
|
instance.m_PreviewObjects.Add(ps.gameObject);
|
||||||
|
EditorUtility.SetDirty(ps.gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Removes the temporary ParticleSystem associated with the specified GameObject.
|
/// Removes the temporary ParticleSystem associated with the specified GameObject.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -145,17 +170,6 @@ namespace Coffee.UIExtensions
|
|||||||
&& ps.hideFlags != k_TemporaryHideFlags;
|
&& ps.hideFlags != k_TemporaryHideFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnEnable()
|
|
||||||
{
|
|
||||||
Selection.selectionChanged -= OnSelectionChanged;
|
|
||||||
Selection.selectionChanged += OnSelectionChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnDisable()
|
|
||||||
{
|
|
||||||
Selection.selectionChanged -= OnSelectionChanged;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnSelectionChanged()
|
private void OnSelectionChanged()
|
||||||
{
|
{
|
||||||
var selectedGameObjects = Selection.gameObjects;
|
var selectedGameObjects = Selection.gameObjects;
|
||||||
|
|||||||
@@ -546,7 +546,7 @@ namespace Coffee.UIExtensions
|
|||||||
var ps = particles[i];
|
var ps = particles[i];
|
||||||
if (!ps
|
if (!ps
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|| ps.hideFlags == HideFlags.HideAndDontSave // Dummy ParticleSystems for preview.
|
|| (ps.hideFlags & HideFlags.DontSave) != 0 // Dummy ParticleSystems for preview.
|
||||||
|| ps.gameObject.CompareTag("EditorOnly") // Ignore "EditorOnly" tagged ParticleSystems.
|
|| ps.gameObject.CompareTag("EditorOnly") // Ignore "EditorOnly" tagged ParticleSystems.
|
||||||
#endif
|
#endif
|
||||||
|| ps.GetComponentInParent<UIParticle>(true) != this) // Ignore ParticleSystems that are not under this UIParticle.
|
|| ps.GetComponentInParent<UIParticle>(true) != this) // Ignore ParticleSystems that are not under this UIParticle.
|
||||||
|
|||||||
@@ -39,6 +39,17 @@ namespace Coffee.UIExtensions
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
|
private static void OnDomainReload()
|
||||||
|
{
|
||||||
|
s_ActiveParticles.Clear();
|
||||||
|
s_ActiveAttractors.Clear();
|
||||||
|
s_UpdatedGroupIds.Clear();
|
||||||
|
s_FrameCount = 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
[InitializeOnLoadMethod]
|
[InitializeOnLoadMethod]
|
||||||
private static void InitializeOnLoad()
|
private static void InitializeOnLoad()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user