You've already forked ParticleEffectForUGUI
mirror of
https://github.com/mob-sakai/ParticleEffectForUGUI.git
synced 2026-07-03 23:33:43 +00:00
Compare commits
7 Commits
64a050f17c
...
e32120b18c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e32120b18c | ||
|
|
58070b3495 | ||
|
|
a84c7db4ef | ||
|
|
1c8aa684c4 | ||
|
|
c019156200 | ||
|
|
827c9a738f | ||
|
|
19b076b319 |
@@ -82,18 +82,6 @@ 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.
|
||||||
//################################
|
//################################
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
Profiler.BeginSample("(COF)[CanvasExt] GetViewProjectionMatrix");
|
Profiler.BeginSample("(COF)[CanvasExt] GetViewProjectionMatrix");
|
||||||
var rootCanvas = canvas.rootCanvas;
|
var rootCanvas = canvas.rootCanvas;
|
||||||
var cam = rootCanvas.worldCamera;
|
var cam = rootCanvas.worldCamera;
|
||||||
if (rootCanvas && rootCanvas.renderMode != RenderMode.ScreenSpaceOverlay && cam)
|
if (rootCanvas != null && rootCanvas.renderMode != RenderMode.ScreenSpaceOverlay && cam != null)
|
||||||
{
|
{
|
||||||
if (eye == Camera.MonoOrStereoscopicEye.Mono)
|
if (eye == Camera.MonoOrStereoscopicEye.Mono)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
{
|
{
|
||||||
T component = null;
|
T component = null;
|
||||||
var transform = self.transform;
|
var transform = self.transform;
|
||||||
while (transform)
|
while (transform != null)
|
||||||
{
|
{
|
||||||
if (transform.TryGetComponent<T>(out var c))
|
if (transform.TryGetComponent<T>(out var c))
|
||||||
{
|
{
|
||||||
@@ -120,7 +120,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
where T : Component
|
where T : Component
|
||||||
{
|
{
|
||||||
var tr = includeSelf ? self.transform : self.transform.parent;
|
var tr = includeSelf ? self.transform : self.transform.parent;
|
||||||
while (tr)
|
while (tr != null)
|
||||||
{
|
{
|
||||||
if (tr.TryGetComponent<T>(out var c) && valid(c)) return c;
|
if (tr.TryGetComponent<T>(out var c) && valid(c)) return c;
|
||||||
if (tr == stopAfter) return null;
|
if (tr == stopAfter) return null;
|
||||||
@@ -197,7 +197,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
if (!includeInactive) return self.GetComponentInParent<T>();
|
if (!includeInactive) return self.GetComponentInParent<T>();
|
||||||
|
|
||||||
var current = self.transform;
|
var current = self.transform;
|
||||||
while (current)
|
while (current != null)
|
||||||
{
|
{
|
||||||
if (current.TryGetComponent<T>(out var c)) return c;
|
if (current.TryGetComponent<T>(out var c)) return c;
|
||||||
current = current.parent;
|
current = current.parent;
|
||||||
|
|||||||
@@ -23,17 +23,14 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
protected static bool s_BuildingPlayer;
|
protected static bool s_BuildingPlayer;
|
||||||
|
|
||||||
private class Postprocessor : AssetPostprocessor
|
private class EditorEvents : AssetPostprocessor, IPreprocessBuildWithReport, IPostprocessBuildWithReport
|
||||||
{
|
{
|
||||||
|
int IOrderedCallback.callbackOrder => 0;
|
||||||
|
|
||||||
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
|
private static void OnPostprocessAllAssets(string[] _, string[] __, string[] ___, string[] ____)
|
||||||
{
|
{
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private class ExcludeFromBuild : IPreprocessBuildWithReport, IPostprocessBuildWithReport
|
|
||||||
{
|
|
||||||
int IOrderedCallback.callbackOrder => 0;
|
|
||||||
|
|
||||||
void IPreprocessBuildWithReport.OnPreprocessBuild(BuildReport report)
|
void IPreprocessBuildWithReport.OnPreprocessBuild(BuildReport report)
|
||||||
{
|
{
|
||||||
@@ -44,11 +41,11 @@ namespace Coffee.UIParticleInternal
|
|||||||
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||||
{
|
{
|
||||||
var settings = GetDefaultSettings(t);
|
var settings = GetDefaultSettings(t);
|
||||||
if (!settings || settings.m_PreLoadSettingsInBuild) continue;
|
if (settings == null || settings.m_PreLoadSettingsInBuild) continue;
|
||||||
|
|
||||||
PlayerSettings.SetPreloadedAssets(
|
PlayerSettings.SetPreloadedAssets(
|
||||||
PlayerSettings.GetPreloadedAssets()
|
PlayerSettings.GetPreloadedAssets()
|
||||||
.Where(x => x && x.GetType() != t)
|
.Where(x => x != null && x.GetType() != t)
|
||||||
.ToArray());
|
.ToArray());
|
||||||
|
|
||||||
Debug.Log($"[PreloadedProjectSettings] Build started: removed '{settings.name}' " +
|
Debug.Log($"[PreloadedProjectSettings] Build started: removed '{settings.name}' " +
|
||||||
@@ -62,6 +59,21 @@ namespace Coffee.UIParticleInternal
|
|||||||
s_BuildingPlayer = false;
|
s_BuildingPlayer = false;
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if UNITY_2019_3_OR_NEWER
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
|
private static void OnDomainReload()
|
||||||
|
{
|
||||||
|
foreach (var t in TypeCache.GetTypesDerivedFrom(typeof(PreloadedProjectSettings<>)))
|
||||||
|
{
|
||||||
|
var defaultSettings = GetDefaultSettings(t);
|
||||||
|
if (defaultSettings != null)
|
||||||
|
{
|
||||||
|
defaultSettings.OnDomainReload();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Initialize()
|
private static void Initialize()
|
||||||
@@ -154,6 +166,10 @@ namespace Coffee.UIParticleInternal
|
|||||||
protected virtual void OnInitialize()
|
protected virtual void OnInitialize()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected virtual void OnDomainReload()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal abstract class PreloadedProjectSettingsEditor : Editor
|
internal abstract class PreloadedProjectSettingsEditor : Editor
|
||||||
@@ -195,13 +211,6 @@ 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;
|
||||||
@@ -229,7 +238,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
|
|
||||||
private void OnPlayModeStateChanged(PlayModeStateChange state)
|
private void OnPlayModeStateChanged(PlayModeStateChange state)
|
||||||
{
|
{
|
||||||
if (!this) return;
|
if (this == null) return;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
@@ -246,8 +255,13 @@ namespace Coffee.UIParticleInternal
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnDomainReload()
|
||||||
|
{
|
||||||
|
s_Instance = null;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
|
public static T instance => s_Instance != null ? s_Instance : s_Instance = CreateInstance<T>();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -263,9 +277,10 @@ namespace Coffee.UIParticleInternal
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
|
||||||
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
||||||
#else
|
#else
|
||||||
if (s_Instance && s_Instance != this)
|
if (s_Instance != null && s_Instance != this)
|
||||||
{
|
{
|
||||||
Destroy(s_Instance);
|
Destroy(s_Instance);
|
||||||
}
|
}
|
||||||
@@ -300,7 +315,7 @@ namespace Coffee.UIParticleInternal
|
|||||||
{
|
{
|
||||||
if (_target == null)
|
if (_target == null)
|
||||||
{
|
{
|
||||||
if (_editor)
|
if (_editor != null)
|
||||||
{
|
{
|
||||||
DestroyImmediate(_editor);
|
DestroyImmediate(_editor);
|
||||||
_editor = null;
|
_editor = null;
|
||||||
|
|||||||
@@ -66,11 +66,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
node = node.Next;
|
node = node.Next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
|
||||||
{
|
|
||||||
_delegates.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -8,19 +8,19 @@ namespace Coffee.UIParticleInternal
|
|||||||
{
|
{
|
||||||
private static readonly Dictionary<Type, IFrameCache> s_Caches = new Dictionary<Type, IFrameCache>();
|
private static readonly Dictionary<Type, IFrameCache> s_Caches = new Dictionary<Type, IFrameCache>();
|
||||||
|
|
||||||
static FrameCache()
|
|
||||||
{
|
|
||||||
s_Caches.Clear();
|
|
||||||
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
#if UNITY_EDITOR && UNITY_2019_3_OR_NEWER
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
|
#elif UNITY_EDITOR
|
||||||
|
[InitializeOnLoadMethod]
|
||||||
|
#else
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
||||||
|
#endif
|
||||||
private static void Clear()
|
private static void Clear()
|
||||||
{
|
{
|
||||||
s_Caches.Clear();
|
s_Caches.Clear();
|
||||||
|
UIExtraCallbacks.onLateAfterCanvasRebuild -= ClearAllCache;
|
||||||
|
UIExtraCallbacks.onLateAfterCanvasRebuild += ClearAllCache;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Tries to retrieve a value from the frame cache with a specified key.
|
/// Tries to retrieve a value from the frame cache with a specified key.
|
||||||
|
|||||||
@@ -93,10 +93,6 @@ namespace Coffee.UIParticleInternal
|
|||||||
{
|
{
|
||||||
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;
|
s_LastScreenSize = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,9 +48,8 @@ namespace Coffee.UIExtensions
|
|||||||
|
|
||||||
#if UNITY_2019_3_OR_NEWER
|
#if UNITY_2019_3_OR_NEWER
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
#else
|
|
||||||
[InitializeOnLoadMethod]
|
|
||||||
#endif
|
#endif
|
||||||
|
[InitializeOnLoadMethod]
|
||||||
public static void Initialize()
|
public static void Initialize()
|
||||||
{
|
{
|
||||||
instance.OnSelectionChanged();
|
instance.OnSelectionChanged();
|
||||||
@@ -113,6 +112,8 @@ namespace Coffee.UIExtensions
|
|||||||
private static void RegisterParticleSystem(ParticleSystem ps)
|
private static void RegisterParticleSystem(ParticleSystem ps)
|
||||||
{
|
{
|
||||||
if (!ps) return;
|
if (!ps) return;
|
||||||
|
if (EditorApplication.isPlaying) return;
|
||||||
|
|
||||||
ps.hideFlags = k_TemporaryHideFlags;
|
ps.hideFlags = k_TemporaryHideFlags;
|
||||||
|
|
||||||
var emission = ps.emission;
|
var emission = ps.emission;
|
||||||
@@ -180,7 +181,7 @@ namespace Coffee.UIExtensions
|
|||||||
{
|
{
|
||||||
m_PreviewObjects.RemoveAt(i);
|
m_PreviewObjects.RemoveAt(i);
|
||||||
}
|
}
|
||||||
else if (!selectedGameObjects.Contains(go))
|
else if (EditorApplication.isPlaying && !selectedGameObjects.Contains(go))
|
||||||
{
|
{
|
||||||
Unregister(go);
|
Unregister(go);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user