mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2026-04-21 20:35:54 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2de8dae2f9 | ||
|
|
866a085dce | ||
|
|
0acbcb2f0b | ||
|
|
c84aa33113 | ||
|
|
8e9882215b | ||
|
|
570a242950 |
@ -1,4 +1,5 @@
|
|||||||
#if UNITY_EDITOR
|
#pragma warning disable CS0162 // Обнаружен недостижимый код
|
||||||
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Compilation;
|
using UnityEditor.Compilation;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -12,42 +13,41 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
{
|
{
|
||||||
DebugXSettings window = (DebugXSettings)EditorWindow.GetWindow(typeof(DebugXSettings));
|
DebugXSettings window = (DebugXSettings)EditorWindow.GetWindow(typeof(DebugXSettings));
|
||||||
window.Show();
|
window.Show();
|
||||||
//window._isHasDisableDebugXInBuildSymbols = null;
|
|
||||||
CompilationPipeline.compilationFinished -= CompilationPipeline_compilationFinished;
|
CompilationPipeline.compilationFinished -= CompilationPipeline_compilationFinished;
|
||||||
CompilationPipeline.compilationFinished += CompilationPipeline_compilationFinished;
|
CompilationPipeline.compilationFinished += CompilationPipeline_compilationFinished;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CompilationPipeline_compilationFinished(object obj)
|
private static void CompilationPipeline_compilationFinished(object obj)
|
||||||
{
|
{
|
||||||
//_isCompilation = false;
|
|
||||||
_defines = null;
|
_defines = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
//private static bool _isCompilation;
|
|
||||||
//private bool? _isHasDisableDebugXInBuildSymbols = false;
|
|
||||||
//private const string DEFINE_NAME = nameof(DebugXDefines.DEBUGX_DISABLE_INBUILD);
|
|
||||||
private static (string name, bool flag)[] _defines = null;
|
private static (string name, bool flag)[] _defines = null;
|
||||||
private static Vector2 _pos;
|
private static Vector2 _pos;
|
||||||
|
|
||||||
private void OnGUI()
|
private void OnGUI()
|
||||||
{
|
{
|
||||||
|
if (DebugXDefines.DISABLE_DEBUGX)
|
||||||
|
{
|
||||||
|
GUI.enabled = false;
|
||||||
|
}
|
||||||
_pos = GUILayout.BeginScrollView(_pos, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
|
_pos = GUILayout.BeginScrollView(_pos, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true));
|
||||||
float tmpValue;
|
float tmpFloat;
|
||||||
|
|
||||||
DebugX.GlobalTimeScale = EditorGUILayout.FloatField("TimeScale", DebugX.GlobalTimeScale);
|
DebugX.GlobalTimeScale = EditorGUILayout.FloatField("TimeScale", DebugX.GlobalTimeScale);
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
tmpValue = EditorGUILayout.Slider(DebugX.GlobalTimeScale, 0, 2);
|
tmpFloat = EditorGUILayout.Slider(DebugX.GlobalTimeScale, 0, 2);
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
DebugX.GlobalTimeScale = tmpValue;
|
DebugX.GlobalTimeScale = tmpFloat;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugX.GlobalDotSize = EditorGUILayout.FloatField("DotSize", DebugX.GlobalDotSize);
|
DebugX.GlobalDotSize = EditorGUILayout.FloatField("DotSize", DebugX.GlobalDotSize);
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
tmpValue = EditorGUILayout.Slider(DebugX.GlobalDotSize, 0, 2);
|
tmpFloat = EditorGUILayout.Slider(DebugX.GlobalDotSize, 0, 2);
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
DebugX.GlobalDotSize = tmpValue;
|
DebugX.GlobalDotSize = tmpFloat;
|
||||||
}
|
}
|
||||||
|
|
||||||
DebugX.GlobalColor = EditorGUILayout.ColorField("Color", DebugX.GlobalColor);
|
DebugX.GlobalColor = EditorGUILayout.ColorField("Color", DebugX.GlobalColor);
|
||||||
@ -58,12 +58,16 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
|
|
||||||
DebugX.GlobalGreaterPassAlpha = EditorGUILayout.FloatField("GreaterPassAlpha", DebugX.GlobalGreaterPassAlpha);
|
DebugX.GlobalGreaterPassAlpha = EditorGUILayout.FloatField("GreaterPassAlpha", DebugX.GlobalGreaterPassAlpha);
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
tmpValue = EditorGUILayout.Slider(DebugX.GlobalGreaterPassAlpha, 0, 1);
|
tmpFloat = EditorGUILayout.Slider(DebugX.GlobalGreaterPassAlpha, 0, 1);
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
DebugX.GlobalGreaterPassAlpha = tmpValue;
|
DebugX.GlobalGreaterPassAlpha = tmpFloat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DebugX.AvailablePoolMemory = EditorGUILayout.IntField("AvailablePoolMemory (kb)", DebugX.AvailablePoolMemory);
|
||||||
|
EditorGUI.BeginChangeCheck();
|
||||||
|
|
||||||
|
|
||||||
if (GUILayout.Button("Reset"))
|
if (GUILayout.Button("Reset"))
|
||||||
{
|
{
|
||||||
DebugX.ResetGlobals();
|
DebugX.ResetGlobals();
|
||||||
@ -72,7 +76,10 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
{
|
{
|
||||||
DebugX.ClearAllGizmos();
|
DebugX.ClearAllGizmos();
|
||||||
}
|
}
|
||||||
|
if (DebugXDefines.DISABLE_DEBUGX)
|
||||||
|
{
|
||||||
|
GUI.enabled = true;
|
||||||
|
}
|
||||||
GUILayout.Space(4);
|
GUILayout.Space(4);
|
||||||
|
|
||||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -27,6 +28,7 @@ namespace DCFApixels
|
|||||||
private const string GLOBAL_DOT_SIZE_PREF_NAME = "DCFApixels.DebugX.DotSize";
|
private const string GLOBAL_DOT_SIZE_PREF_NAME = "DCFApixels.DebugX.DotSize";
|
||||||
private const string GLOBAL_COLOR_PREF_NAME = "DCFApixels.DebugX.Color";
|
private const string GLOBAL_COLOR_PREF_NAME = "DCFApixels.DebugX.Color";
|
||||||
private const string GLOBAL_GREATER_PASS_ALPHA_PREF_NAME = "DCFApixels.DebugX.GreaterPassAlpha";
|
private const string GLOBAL_GREATER_PASS_ALPHA_PREF_NAME = "DCFApixels.DebugX.GreaterPassAlpha";
|
||||||
|
private const string GLOBAL_AVAILABLE_POOL_MEMORY_PREF_NAME = "DCFApixels.DebugX.AvailablePoolMemory";
|
||||||
|
|
||||||
private readonly static int GlobalDotSizePropertyID = Shader.PropertyToID("_DebugX_GlobalDotSize");
|
private readonly static int GlobalDotSizePropertyID = Shader.PropertyToID("_DebugX_GlobalDotSize");
|
||||||
private readonly static int GlobalColorPropertyID = Shader.PropertyToID("_DebugX_GlobalColor");
|
private readonly static int GlobalColorPropertyID = Shader.PropertyToID("_DebugX_GlobalColor");
|
||||||
@ -53,8 +55,8 @@ namespace DCFApixels.DebugXCore
|
|||||||
{
|
{
|
||||||
public static class DebugXDefines
|
public static class DebugXDefines
|
||||||
{
|
{
|
||||||
public const bool DISABLE_DEBUG =
|
public const bool DISABLE_DEBUGX =
|
||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
true;
|
true;
|
||||||
#else
|
#else
|
||||||
false;
|
false;
|
||||||
@ -79,3 +81,24 @@ namespace DCFApixels.DebugXCore
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Example of DefineConstsType
|
||||||
|
// public static class SomeDefineConstsType
|
||||||
|
// {
|
||||||
|
// public const bool SOME_DEFINE_1 =
|
||||||
|
// #if SOME_DEFINE_1
|
||||||
|
// true;
|
||||||
|
// #else
|
||||||
|
// false;
|
||||||
|
// #endif
|
||||||
|
// public const bool SOME_DEFINE_2 =
|
||||||
|
// #if SOME_DEFINE_2
|
||||||
|
// true;
|
||||||
|
// #else
|
||||||
|
// false;
|
||||||
|
// #endif
|
||||||
|
// // ...
|
||||||
|
// }
|
||||||
@ -1,8 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#endif
|
#undef UNITY_EDITOR
|
||||||
#if DEBUG
|
|
||||||
#define DEV_MODE
|
|
||||||
#endif
|
#endif
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -16,7 +14,9 @@ using UnityEngine.LowLevel;
|
|||||||
using UnityEngine.PlayerLoop;
|
using UnityEngine.PlayerLoop;
|
||||||
using Unity.Collections.LowLevel.Unsafe;
|
using Unity.Collections.LowLevel.Unsafe;
|
||||||
using DCFApixels.DebugXCore.Internal;
|
using DCFApixels.DebugXCore.Internal;
|
||||||
using System.Linq;
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Buffers;
|
||||||
|
|
||||||
namespace DCFApixels
|
namespace DCFApixels
|
||||||
{
|
{
|
||||||
@ -44,19 +44,26 @@ namespace DCFApixels
|
|||||||
{
|
{
|
||||||
var invocationList = eventToClean.GetInvocationList();
|
var invocationList = eventToClean.GetInvocationList();
|
||||||
|
|
||||||
var validDelegates = invocationList
|
var buffer = ArrayPool<Delegate>.Shared.Rent(invocationList.Length);
|
||||||
.Where(d => d.Target as UnityEngine.Object == null || d.Target as UnityEngine.Object != null)
|
var bufferCount = 0;
|
||||||
.Where(d => !(d.Target is UnityEngine.Object targetObj) || targetObj != null)
|
foreach (var invocation in invocationList)
|
||||||
.ToArray();
|
{
|
||||||
|
if(!(invocation.Target is UnityEngine.Object targetObj) || targetObj != null)
|
||||||
|
{
|
||||||
|
buffer[bufferCount++] = invocation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (validDelegates.Length != invocationList.Length)
|
if (bufferCount != invocationList.Length)
|
||||||
{
|
{
|
||||||
eventToClean = null;
|
eventToClean = null;
|
||||||
foreach (var delegateItem in validDelegates)
|
for (int i = 0; i < bufferCount; i++)
|
||||||
{
|
{
|
||||||
eventToClean += (OnDrawGizmoHandler)delegateItem;
|
eventToClean += (OnDrawGizmoHandler)buffer[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ArrayPool<Delegate>.Shared.Return(buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static void CleanupOnDrawGizmo()
|
internal static void CleanupOnDrawGizmo()
|
||||||
@ -83,7 +90,7 @@ namespace DCFApixels
|
|||||||
private static ulong _timeTicks = 0;
|
private static ulong _timeTicks = 0;
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
private static readonly Unity.Profiling.ProfilerMarker _onDrawGizmoCalllback = new Unity.Profiling.ProfilerMarker($"{nameof(DebugX)}.{nameof(DebugXEvents.OnDrawGizmo)}");
|
private static readonly Unity.Profiling.ProfilerMarker _onDrawGizmoCallback = new Unity.Profiling.ProfilerMarker($"{nameof(DebugX)}.{nameof(DebugXEvents.OnDrawGizmo)}");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public static ulong RenderTicks
|
public static ulong RenderTicks
|
||||||
@ -119,6 +126,7 @@ namespace DCFApixels
|
|||||||
#region ctor
|
#region ctor
|
||||||
static DebugX()
|
static DebugX()
|
||||||
{
|
{
|
||||||
|
#if UNITY_EDITOR || !DEBUGX_DISABLE_INBUILD
|
||||||
InitGlobals();
|
InitGlobals();
|
||||||
|
|
||||||
if (IsSRP)
|
if (IsSRP)
|
||||||
@ -164,7 +172,7 @@ namespace DCFApixels
|
|||||||
|
|
||||||
//Application.onBeforeRender -= Application_onBeforeRender;
|
//Application.onBeforeRender -= Application_onBeforeRender;
|
||||||
//Application.onBeforeRender += Application_onBeforeRender;
|
//Application.onBeforeRender += Application_onBeforeRender;
|
||||||
|
#endif
|
||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
EditorApplication.pauseStateChanged -= EditorApplication_pauseStateChanged;
|
EditorApplication.pauseStateChanged -= EditorApplication_pauseStateChanged;
|
||||||
@ -369,7 +377,7 @@ namespace DCFApixels
|
|||||||
if (DebugXUtility.IsGizmosRender())
|
if (DebugXUtility.IsGizmosRender())
|
||||||
{
|
{
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using (_onDrawGizmoCalllback.Auto())
|
using (_onDrawGizmoCallback.Auto())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
DebugXEvents.InvokeOnDrawGizmo(camera);
|
DebugXEvents.InvokeOnDrawGizmo(camera);
|
||||||
@ -661,6 +669,25 @@ namespace DCFApixels
|
|||||||
}
|
}
|
||||||
private class GizmosBuffer<T> : GizmosBuffer where T : IGizmo<T>
|
private class GizmosBuffer<T> : GizmosBuffer where T : IGizmo<T>
|
||||||
{
|
{
|
||||||
|
private static int _lastAvailablePoolMemory;
|
||||||
|
private static int _bufferMaxSize;
|
||||||
|
private static readonly int _elementSize = RuntimeHelpers.IsReferenceOrContainsReferences<T>() ? sizeof(IntPtr) : Marshal.SizeOf<T>();
|
||||||
|
private static void CheckAvailablePoolMemory()
|
||||||
|
{
|
||||||
|
if(_bufferMaxSize != 0 && _lastAvailablePoolMemory == DebugX.AvailablePoolMemory)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(DebugX.AvailablePoolMemory < _elementSize * 10)
|
||||||
|
{
|
||||||
|
_bufferMaxSize = DebugX.AvailablePoolMemory * 1024 / _elementSize;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_bufferMaxSize = DebugX.AvailablePoolMemory / _elementSize * 1024;
|
||||||
|
}
|
||||||
|
_lastAvailablePoolMemory = DebugX.AvailablePoolMemory;
|
||||||
|
}
|
||||||
private class DummyRenderer : IGizmoRenderer<T>
|
private class DummyRenderer : IGizmoRenderer<T>
|
||||||
{
|
{
|
||||||
public int ExecuteOrder { get { return 0; } }
|
public int ExecuteOrder { get { return 0; } }
|
||||||
@ -681,7 +708,7 @@ namespace DCFApixels
|
|||||||
private readonly IGizmoRenderer_PostRender<T> _rendererUnityGizmos;
|
private readonly IGizmoRenderer_PostRender<T> _rendererUnityGizmos;
|
||||||
private readonly bool _isStatic;
|
private readonly bool _isStatic;
|
||||||
|
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
private static readonly Unity.Profiling.ProfilerMarker _timerMarker = new Unity.Profiling.ProfilerMarker($"{DebugXUtility.GetGenericTypeName(typeof(T), 3, false)}.{nameof(UpdateTimer)}");
|
private static readonly Unity.Profiling.ProfilerMarker _timerMarker = new Unity.Profiling.ProfilerMarker($"{DebugXUtility.GetGenericTypeName(typeof(T), 3, false)}.{nameof(UpdateTimer)}");
|
||||||
private static readonly Unity.Profiling.ProfilerMarker _prepareMarker = new Unity.Profiling.ProfilerMarker($"{DebugXUtility.GetGenericTypeName(typeof(T), 3, false)}.{nameof(Prepare)}");
|
private static readonly Unity.Profiling.ProfilerMarker _prepareMarker = new Unity.Profiling.ProfilerMarker($"{DebugXUtility.GetGenericTypeName(typeof(T), 3, false)}.{nameof(Prepare)}");
|
||||||
private static readonly Unity.Profiling.ProfilerMarker _renderMarker = new Unity.Profiling.ProfilerMarker($"{DebugXUtility.GetGenericTypeName(typeof(T), 3, false)}.{nameof(Render)}");
|
private static readonly Unity.Profiling.ProfilerMarker _renderMarker = new Unity.Profiling.ProfilerMarker($"{DebugXUtility.GetGenericTypeName(typeof(T), 3, false)}.{nameof(Render)}");
|
||||||
@ -714,11 +741,17 @@ namespace DCFApixels
|
|||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
public void Add(T value, float time, Color color)
|
public void Add(T value, float time, Color color)
|
||||||
{
|
{
|
||||||
|
CheckAvailablePoolMemory();
|
||||||
|
if ((_gizmos.Count + 1) >= _bufferMaxSize) { return; }
|
||||||
|
|
||||||
_gizmos.Add(new GizmoInternal<T>(value, time, color));
|
_gizmos.Add(new GizmoInternal<T>(value, time, color));
|
||||||
}
|
}
|
||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
public void AddRange(ReadOnlySpan<T> values, float time, Color color)
|
public void AddRange(ReadOnlySpan<T> values, float time, Color color)
|
||||||
{
|
{
|
||||||
|
CheckAvailablePoolMemory();
|
||||||
|
if ((_gizmos.Count + values.Length) >= _bufferMaxSize) { return; }
|
||||||
|
|
||||||
_gizmos.UpSize(_gizmos._count + values.Length);
|
_gizmos.UpSize(_gizmos._count + values.Length);
|
||||||
for (int i = 0; i < values.Length; i++)
|
for (int i = 0; i < values.Length; i++)
|
||||||
{
|
{
|
||||||
@ -726,11 +759,12 @@ namespace DCFApixels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public sealed override int UpdateTimer(float deltaTime)
|
public sealed override int UpdateTimer(float deltaTime)
|
||||||
{
|
{
|
||||||
_staticCommandBuffer.Clear();
|
_staticCommandBuffer.Clear();
|
||||||
int removeCount = 0;
|
int removeCount = 0;
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
using (_timerMarker.Auto())
|
using (_timerMarker.Auto())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -753,7 +787,7 @@ namespace DCFApixels
|
|||||||
public sealed override int RunEnd()
|
public sealed override int RunEnd()
|
||||||
{
|
{
|
||||||
int removeCount = 0;
|
int removeCount = 0;
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
using (_timerMarker.Auto())
|
using (_timerMarker.Auto())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -786,7 +820,7 @@ namespace DCFApixels
|
|||||||
public override void Prepare()
|
public override void Prepare()
|
||||||
{
|
{
|
||||||
if (_gizmos.Count <= 0) { return; }
|
if (_gizmos.Count <= 0) { return; }
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
using (_prepareMarker.Auto())
|
using (_prepareMarker.Auto())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -806,7 +840,7 @@ namespace DCFApixels
|
|||||||
public override void Render(ICommandBufferExecutor cbExecutor)
|
public override void Render(ICommandBufferExecutor cbExecutor)
|
||||||
{
|
{
|
||||||
if (_gizmos.Count <= 0) { return; }
|
if (_gizmos.Count <= 0) { return; }
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
using (_renderMarker.Auto())
|
using (_renderMarker.Auto())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
@ -829,7 +863,7 @@ namespace DCFApixels
|
|||||||
if (_rendererUnityGizmos == null) { return; }
|
if (_rendererUnityGizmos == null) { return; }
|
||||||
//Debug.Log(_gizmos._count);
|
//Debug.Log(_gizmos._count);
|
||||||
if (_gizmos.Count <= 0) { return; }
|
if (_gizmos.Count <= 0) { return; }
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
using (_renderMarker.Auto())
|
using (_renderMarker.Auto())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
@ -67,6 +68,20 @@ namespace DCFApixels
|
|||||||
|
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
EditorPrefs.SetFloat(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME, _globalGreaterPassAlphaCache);
|
EditorPrefs.SetFloat(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME, _globalGreaterPassAlphaCache);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private static int _availablePoolMemory; //KB
|
||||||
|
public static int AvailablePoolMemory
|
||||||
|
{
|
||||||
|
get { return _availablePoolMemory; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
value = Mathf.Max(0, value);
|
||||||
|
if (_availablePoolMemory == value) { return; }
|
||||||
|
_availablePoolMemory = value;
|
||||||
|
#if UNITY_EDITOR
|
||||||
|
EditorPrefs.SetInt(GLOBAL_AVAILABLE_POOL_MEMORY_PREF_NAME, value);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -77,6 +92,7 @@ namespace DCFApixels
|
|||||||
EditorPrefs.DeleteKey(GLOBAL_DOT_SIZE_PREF_NAME);
|
EditorPrefs.DeleteKey(GLOBAL_DOT_SIZE_PREF_NAME);
|
||||||
EditorPrefs.DeleteKey(GLOBAL_COLOR_PREF_NAME);
|
EditorPrefs.DeleteKey(GLOBAL_COLOR_PREF_NAME);
|
||||||
EditorPrefs.DeleteKey(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME);
|
EditorPrefs.DeleteKey(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME);
|
||||||
|
EditorPrefs.DeleteKey(GLOBAL_AVAILABLE_POOL_MEMORY_PREF_NAME);
|
||||||
#endif
|
#endif
|
||||||
_timeScaleCache = default;
|
_timeScaleCache = default;
|
||||||
_dotSizeCache = default;
|
_dotSizeCache = default;
|
||||||
@ -92,11 +108,13 @@ namespace DCFApixels
|
|||||||
var colorCode = EditorPrefs.GetInt(GLOBAL_COLOR_PREF_NAME, -1);
|
var colorCode = EditorPrefs.GetInt(GLOBAL_COLOR_PREF_NAME, -1);
|
||||||
GlobalColor = (Color)(*(Color32*)&colorCode);
|
GlobalColor = (Color)(*(Color32*)&colorCode);
|
||||||
GlobalGreaterPassAlpha = EditorPrefs.GetFloat(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME, 0.1f);
|
GlobalGreaterPassAlpha = EditorPrefs.GetFloat(GLOBAL_GREATER_PASS_ALPHA_PREF_NAME, 0.1f);
|
||||||
|
AvailablePoolMemory = EditorPrefs.GetInt(GLOBAL_AVAILABLE_POOL_MEMORY_PREF_NAME, 524288);
|
||||||
#else
|
#else
|
||||||
GlobalTimeScale = 1;
|
GlobalTimeScale = 1;
|
||||||
GlobalDotSize = 1;
|
GlobalDotSize = 1;
|
||||||
GlobalColor = Color.white;
|
GlobalColor = Color.white;
|
||||||
GlobalGreaterPassAlpha = 0.1f;
|
GlobalGreaterPassAlpha = 0.1f;
|
||||||
|
AvailablePoolMemory = 524288;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
using DCFApixels.DebugXCore;
|
using DCFApixels.DebugXCore;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
using DCFApixels.DebugXCore;
|
using DCFApixels.DebugXCore;
|
||||||
using DCFApixels.DebugXCore.Internal;
|
using DCFApixels.DebugXCore.Internal;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
using DCFApixels.DebugXCore;
|
using DCFApixels.DebugXCore;
|
||||||
using System;
|
using System;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
using DCFApixels.DebugXCore.Internal;
|
using DCFApixels.DebugXCore.Internal;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -29,7 +30,7 @@ namespace DCFApixels
|
|||||||
_singleWarningToggle = false;
|
_singleWarningToggle = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
settings = settings.SetSize(DebugXTextSettings.DEFAULT_FONT_SIZE);
|
settings = settings.Size(DebugXTextSettings.DEFAULT_FONT_SIZE);
|
||||||
}
|
}
|
||||||
return h.Gizmo(new TextGizmo(position, text, settings));
|
return h.Gizmo(new TextGizmo(position, text, settings));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@ -1,8 +1,4 @@
|
|||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
#define DEV_MODE
|
|
||||||
#endif
|
|
||||||
using System;
|
using System;
|
||||||
using System.Buffers;
|
using System.Buffers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -13,10 +9,6 @@ using static DCFApixels.DebugX;
|
|||||||
namespace DCFApixels.DebugXCore.Internal
|
namespace DCFApixels.DebugXCore.Internal
|
||||||
{
|
{
|
||||||
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
using IN = System.Runtime.CompilerServices.MethodImplAttribute;
|
||||||
internal interface IStructListElement<T>
|
|
||||||
{
|
|
||||||
void OnSwap(ref T element);
|
|
||||||
}
|
|
||||||
[System.Diagnostics.DebuggerDisplay("Count: {Count}")]
|
[System.Diagnostics.DebuggerDisplay("Count: {Count}")]
|
||||||
internal struct StructList
|
internal struct StructList
|
||||||
{
|
{
|
||||||
@ -42,11 +34,6 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
[System.Diagnostics.DebuggerDisplay("Count: {Count}")]
|
[System.Diagnostics.DebuggerDisplay("Count: {Count}")]
|
||||||
internal struct StructList<T> : IDisposable
|
internal struct StructList<T> : IDisposable
|
||||||
{
|
{
|
||||||
//private struct Dummy : IStructListElement<T>
|
|
||||||
//{
|
|
||||||
// public void OnSwap(ref T element) { }
|
|
||||||
//}
|
|
||||||
//private static IStructListElement<T> _internal = default(T) as IStructListElement<T> ?? default(Dummy);
|
|
||||||
internal T[] _items;
|
internal T[] _items;
|
||||||
internal int _count;
|
internal int _count;
|
||||||
internal readonly bool _isUseArrayPool;
|
internal readonly bool _isUseArrayPool;
|
||||||
@ -76,7 +63,7 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
||||||
#endif
|
#endif
|
||||||
return _items[index];
|
return _items[index];
|
||||||
@ -84,7 +71,7 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
||||||
#endif
|
#endif
|
||||||
_items[index] = value;
|
_items[index] = value;
|
||||||
@ -117,7 +104,6 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
public void Add(T item)
|
public void Add(T item)
|
||||||
{
|
{
|
||||||
UpSize(_count + 1);
|
UpSize(_count + 1);
|
||||||
//_internal.OnSwap(ref item);
|
|
||||||
_items[_count++] = item;
|
_items[_count++] = item;
|
||||||
}
|
}
|
||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
@ -126,7 +112,6 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
UpSize(_count + items.Length);
|
UpSize(_count + items.Length);
|
||||||
for (int i = 0; i < items.Length; i++)
|
for (int i = 0; i < items.Length; i++)
|
||||||
{
|
{
|
||||||
//_internal.OnSwap(ref item);
|
|
||||||
_items[_count++] = items[i];
|
_items[_count++] = items[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -161,38 +146,33 @@ namespace DCFApixels.DebugXCore.Internal
|
|||||||
T tmp = _items[idnex1];
|
T tmp = _items[idnex1];
|
||||||
_items[idnex1] = _items[idnex2];
|
_items[idnex1] = _items[idnex2];
|
||||||
_items[idnex2] = tmp;
|
_items[idnex2] = tmp;
|
||||||
//_internal.OnSwap(ref _items[idnex1]);
|
|
||||||
//_internal.OnSwap(ref _items[idnex2]);
|
|
||||||
}
|
}
|
||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
public void FastRemoveAt(int index)
|
public void FastRemoveAt(int index)
|
||||||
{
|
{
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
||||||
#endif
|
#endif
|
||||||
_items[index] = _items[--_count];
|
_items[index] = _items[--_count];
|
||||||
//_internal.OnSwap(ref _items[index]);
|
|
||||||
}
|
}
|
||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
public void RemoveAt(int index)
|
public void RemoveAt(int index)
|
||||||
{
|
{
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
||||||
#endif
|
#endif
|
||||||
_items[index] = _items[--_count];
|
_items[index] = _items[--_count];
|
||||||
//_internal.OnSwap(ref _items[index]);
|
|
||||||
_items[_count] = default;
|
_items[_count] = default;
|
||||||
}
|
}
|
||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
public void RemoveAtWithOrder(int index)
|
public void RemoveAtWithOrder(int index)
|
||||||
{
|
{
|
||||||
#if DEV_MODE
|
#if DEBUG
|
||||||
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
if (index < 0 || index >= _count) { new ArgumentOutOfRangeException(); }
|
||||||
#endif
|
#endif
|
||||||
for (int i = index; i < _count; i++)
|
for (int i = index; i < _count; i++)
|
||||||
{
|
{
|
||||||
_items[i] = _items[i + 1];
|
_items[i] = _items[i + 1];
|
||||||
//_internal.OnSwap(ref _items[i]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[IN(LINE)]
|
[IN(LINE)]
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
|
#undef UNITY_EDITOR
|
||||||
#endif
|
#endif
|
||||||
#if UNITY_EDITOR
|
#if UNITY_EDITOR
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
#if DISABLE_DEBUG
|
#if DISABLE_DEBUGX
|
||||||
#undef DEBUG
|
#undef DEBUG
|
||||||
#endif
|
#undef UNITY_EDITOR
|
||||||
#if DEBUG
|
|
||||||
#define DEV_MODE
|
|
||||||
#endif
|
#endif
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
"displayName": "DebugX",
|
"displayName": "DebugX",
|
||||||
"description": "",
|
"description": "",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
"version": "0.8.14",
|
"version": "0.8.16",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/DCFApixels/DebugX.git"
|
"url": "https://github.com/DCFApixels/DebugX.git"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user