mirror of
https://github.com/DCFApixels/Unity-DebugX.git
synced 2025-09-18 01:54:37 +08:00
Compare commits
12 Commits
f440dfcb20
...
6f354f77e0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
6f354f77e0 | ||
![]() |
4f848de1a3 | ||
![]() |
4477d510f6 | ||
![]() |
9c52a097c2 | ||
![]() |
d0ac5a165e | ||
![]() |
e23e157285 | ||
![]() |
90e44311d3 | ||
![]() |
45d3885aa2 | ||
![]() |
be682a4edd | ||
![]() |
50fbaf1561 | ||
![]() |
624379c950 | ||
![]() |
6a11d981d4 |
@ -1,6 +1,5 @@
|
||||
#if UNITY_EDITOR
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
using UnityEditor.Compilation;
|
||||
using UnityEngine;
|
||||
|
||||
@ -13,22 +12,24 @@ namespace DCFApixels.DebugXCore.Internal
|
||||
{
|
||||
DebugXSettings window = (DebugXSettings)EditorWindow.GetWindow(typeof(DebugXSettings));
|
||||
window.Show();
|
||||
window._isHasDisableDebugXInBuildSymbols = null;
|
||||
//window._isHasDisableDebugXInBuildSymbols = null;
|
||||
CompilationPipeline.compilationFinished -= CompilationPipeline_compilationFinished;
|
||||
CompilationPipeline.compilationFinished += CompilationPipeline_compilationFinished;
|
||||
}
|
||||
|
||||
private static void CompilationPipeline_compilationFinished(object obj)
|
||||
{
|
||||
_isCompilation = false;
|
||||
//_isCompilation = false;
|
||||
_defines = null;
|
||||
}
|
||||
|
||||
private static bool _isCompilation;
|
||||
private bool? _isHasDisableDebugXInBuildSymbols = false;
|
||||
private const string DEFINE_NAME = nameof(DebugXDefines.DISABLE_DEBUGX_INBUILD);
|
||||
|
||||
//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 void OnGUI()
|
||||
{
|
||||
|
||||
float tmpValue;
|
||||
|
||||
DebugX.GlobalTimeScale = EditorGUILayout.FloatField("TimeScale", DebugX.GlobalTimeScale);
|
||||
@ -53,55 +54,76 @@ namespace DCFApixels.DebugXCore.Internal
|
||||
DebugX.GlobalColor = color;
|
||||
|
||||
|
||||
if (_isCompilation == false)
|
||||
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||
GUILayout.Label("Scripting Define Symbols", EditorStyles.helpBox);
|
||||
if (_defines == null)
|
||||
{
|
||||
if (_isHasDisableDebugXInBuildSymbols == null)
|
||||
{
|
||||
BuildTargetGroup group = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
string symbolsString = PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group));
|
||||
#else
|
||||
string symbolsString = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
||||
#endif
|
||||
_isHasDisableDebugXInBuildSymbols = symbolsString.Contains(DEFINE_NAME);
|
||||
}
|
||||
|
||||
EditorGUI.BeginChangeCheck();
|
||||
_isHasDisableDebugXInBuildSymbols = !EditorGUILayout.ToggleLeft("Show Gizmos in Build", !_isHasDisableDebugXInBuildSymbols.Value);
|
||||
|
||||
if (EditorGUI.EndChangeCheck())
|
||||
{
|
||||
BuildTargetGroup group = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
string symbolsString = PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group));
|
||||
#else
|
||||
string symbolsString = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
||||
#endif
|
||||
if (symbolsString.Contains(DEFINE_NAME) == false)
|
||||
{
|
||||
symbolsString = symbolsString + ", " + DEFINE_NAME;
|
||||
}
|
||||
else
|
||||
{
|
||||
symbolsString = symbolsString.Replace(DEFINE_NAME, "");
|
||||
|
||||
}
|
||||
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
PlayerSettings.SetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group), symbolsString);
|
||||
#else
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, symbolsString);
|
||||
#endif
|
||||
_isCompilation = true;
|
||||
}
|
||||
_defines = DefinesUtility.LoadDefines(typeof(DebugXDefines));
|
||||
}
|
||||
else
|
||||
for (int i = 0; i < _defines.Length; i++)
|
||||
{
|
||||
_isHasDisableDebugXInBuildSymbols = null;
|
||||
GUI.enabled = false;
|
||||
EditorGUILayout.ToggleLeft("Show Gizmos in Build (Locked for compilation)", false);
|
||||
GUI.enabled = true;
|
||||
ref var define = ref _defines[i];
|
||||
define.flag = EditorGUILayout.ToggleLeft(define.name, define.flag);
|
||||
}
|
||||
if (GUILayout.Button("Apply Defines"))
|
||||
{
|
||||
DefinesUtility.ApplyDefines(_defines);
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
|
||||
// if (_isCompilation == false)
|
||||
// {
|
||||
// if (_isHasDisableDebugXInBuildSymbols == null)
|
||||
// {
|
||||
// BuildTargetGroup group = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||
//#if UNITY_6000_0_OR_NEWER
|
||||
// string symbolsString = PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group));
|
||||
//#else
|
||||
// string symbolsString = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
||||
//#endif
|
||||
// _isHasDisableDebugXInBuildSymbols = symbolsString.Contains(DEFINE_NAME);
|
||||
// }
|
||||
//
|
||||
// EditorGUI.BeginChangeCheck();
|
||||
// _isHasDisableDebugXInBuildSymbols = !EditorGUILayout.ToggleLeft("Show Gizmos in Build", !_isHasDisableDebugXInBuildSymbols.Value);
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// if (EditorGUI.EndChangeCheck())
|
||||
// {
|
||||
// BuildTargetGroup group = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||
//#if UNITY_6000_0_OR_NEWER
|
||||
// string symbolsString = PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group));
|
||||
//#else
|
||||
// string symbolsString = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
||||
//#endif
|
||||
// if (symbolsString.Contains(DEFINE_NAME) == false)
|
||||
// {
|
||||
// symbolsString = symbolsString + ", " + DEFINE_NAME;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// symbolsString = symbolsString.Replace(DEFINE_NAME, "");
|
||||
//
|
||||
// }
|
||||
//
|
||||
//#if UNITY_6000_0_OR_NEWER
|
||||
// PlayerSettings.SetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group), symbolsString);
|
||||
//#else
|
||||
// PlayerSettings.SetScriptingDefineSymbolsForGroup(group, symbolsString);
|
||||
//#endif
|
||||
// _isCompilation = true;
|
||||
// }
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// _isHasDisableDebugXInBuildSymbols = null;
|
||||
// GUI.enabled = false;
|
||||
// EditorGUILayout.ToggleLeft("Show Gizmos in Build (Locked for compilation)", false);
|
||||
// GUI.enabled = true;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
40
Editor/Settings/DefinesUtility.cs
Normal file
40
Editor/Settings/DefinesUtility.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build;
|
||||
|
||||
namespace DCFApixels.DebugXCore.Internal
|
||||
{
|
||||
internal static class DefinesUtility
|
||||
{
|
||||
public static (string name, bool flag)[] LoadDefines(Type defineConstsType)
|
||||
{
|
||||
const BindingFlags REFL_FLAGS = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
|
||||
var fields = defineConstsType.GetFields(REFL_FLAGS);
|
||||
return fields.Where(o => o.FieldType == typeof(bool)).Select(o => (o.Name, (bool)o.GetValue(null))).ToArray();
|
||||
|
||||
}
|
||||
|
||||
public static void ApplyDefines((string name, bool flag)[] defines)
|
||||
{
|
||||
BuildTargetGroup group = EditorUserBuildSettings.selectedBuildTargetGroup;
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
string symbolsString = PlayerSettings.GetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group));
|
||||
#else
|
||||
string symbolsString = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
|
||||
#endif
|
||||
|
||||
for (int i = 0; i < defines.Length; i++)
|
||||
{
|
||||
symbolsString = symbolsString.Replace(defines[i].name, "");
|
||||
}
|
||||
symbolsString += ";" + string.Join(';', defines.Where(o => o.flag).Select(o => o.name));
|
||||
#if UNITY_6000_0_OR_NEWER
|
||||
PlayerSettings.SetScriptingDefineSymbols(NamedBuildTarget.FromBuildTargetGroup(group), symbolsString);
|
||||
#else
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, symbolsString);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
2
Editor/Settings/DefinesUtility.cs.meta
Normal file
2
Editor/Settings/DefinesUtility.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77addf06144f4214a925257238d65cb0
|
@ -151,7 +151,7 @@ public struct SomeMesh : IStaticMesh
|
||||
# Настройки
|
||||
Окно настроек "Tools -> DebugX -> Settings":
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||
@ -253,4 +253,7 @@ SomeAssets assets = DebugXUtility.LoadStaticData(new SomeAssets(), "SomeAssets")
|
||||
<br>
|
||||
|
||||
# Define Symbols
|
||||
+ `DISABLE_DEBUGX_INBUILD` - по умолчанию Gizmo будут рисовать в сборке проекта, этот дефайн отключает рисование. Включить или выключить можно так же в окне настроек DebugX.
|
||||
Все Define Symbols можно менять в окне настроек.
|
||||
+ `DEBUGX_DISABLE_INBUILD` - По умолчанию Gizmo будут рисовать в сборке проекта, этот дефайн отключает рисование.
|
||||
+ `DEBUGX_ENABLE_PHYSICS2D` - Включает Gizmos для Physics2D.
|
||||
+ `DEBUGX_ENABLE_PHYSICS3D` - Включает Gizmos для Physics3D.
|
@ -154,7 +154,7 @@ public struct SomeMesh : IStaticMesh
|
||||
# 设置
|
||||
设置窗口位于 "Tools -> DebugX -> Settings":
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||
@ -256,4 +256,7 @@ SomeAssets assets = DebugXUtility.LoadStaticData(new SomeAssets(), "SomeAssets")
|
||||
<br>
|
||||
|
||||
# Define Symbols
|
||||
+ `DISABLE_DEBUGX_INBUILD` - By default, Gizmos will be drawn in the project build. This define disables drawing. It can also be enabled or disabled in the DebugX settings window.
|
||||
All Define Symbols can be changed in the settings window
|
||||
+ `DEBUGX_DISABLE_INBUILD` - By default, Gizmos will be drawn in the project build. This define disables drawing.
|
||||
+ `DEBUGX_ENABLE_PHYSICS2D` - Enable Physics2D Gizmos.
|
||||
+ `DEBUGX_ENABLE_PHYSICS3D` - Enable Physics3D Gizmos.
|
@ -39,7 +39,7 @@
|
||||
|
||||
</br>
|
||||
|
||||
A multifunctional, extensible, and high-performance Gizmos drawing utility for Unity. It works both in the editor and in the build, and drawing can be done both in OnDrawGizmos and in Update. HDRP, URP, and BRP are supported, but drawing in the OnDrawGizmos callbacks is not supported in BRP.
|
||||
A multifunctional, extensible, and high-performance Gizmos drawing utility for Unity. It works both in the editor and in the build, and drawing can be done both in `OnDrawGizmos` and in `Update`. HDRP, URP, and BRP are supported, but drawing in the `OnDrawGizmos` callbacks is not supported in BRP.
|
||||
|
||||
Syntax:
|
||||
```c#
|
||||
@ -150,7 +150,7 @@ public struct SomeMesh : IStaticMesh
|
||||
# Settings
|
||||
Settings window "Tools -> DebugX -> Settings":
|
||||
|
||||

|
||||

|
||||
|
||||
<br>
|
||||
|
||||
@ -252,4 +252,7 @@ SomeAssets assets = DebugXUtility.LoadStaticData(new SomeAssets(), "SomeAssets")
|
||||
<br>
|
||||
|
||||
# Define Symbols
|
||||
+ `DISABLE_DEBUGX_INBUILD` - By default, Gizmos will be drawn in the project build. This define disables drawing. It can also be enabled or disabled in the DebugX settings window.
|
||||
All Define Symbols can be changed in the settings window
|
||||
+ `DEBUGX_DISABLE_INBUILD` - By default, Gizmos will be drawn in the project build. This define disables drawing.
|
||||
+ `DEBUGX_ENABLE_PHYSICS2D` - Enable Physics2D Gizmos.
|
||||
+ `DEBUGX_ENABLE_PHYSICS3D` - Enable Physics3D Gizmos.
|
||||
|
@ -47,8 +47,20 @@ namespace DCFApixels.DebugXCore
|
||||
{
|
||||
public static class DebugXDefines
|
||||
{
|
||||
public const bool DISABLE_DEBUGX_INBUILD =
|
||||
#if DISABLE_DEBUGX_INBUILD
|
||||
public const bool DEBUGX_DISABLE_INBUILD =
|
||||
#if DEBUGX_DISABLE_INBUILD
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
public const bool DEBUGX_ENABLE_PHYSICS2D =
|
||||
#if DEBUGX_ENABLE_PHYSICS2D
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
#endif
|
||||
public const bool DEBUGX_ENABLE_PHYSICS3D =
|
||||
#if DEBUGX_ENABLE_PHYSICS3D
|
||||
true;
|
||||
#else
|
||||
false;
|
||||
|
@ -10,6 +10,7 @@ namespace DCFApixels
|
||||
private const float ShadowAlphaMultiplier = 0.3f;
|
||||
public readonly partial struct DrawHandler
|
||||
{
|
||||
#if DEBUGX_ENABLE_PHYSICS3D
|
||||
#region RaycastHit
|
||||
[IN(LINE)]
|
||||
public DrawHandler RaycastHit(RaycastHit hit)
|
||||
@ -21,25 +22,8 @@ namespace DCFApixels
|
||||
}
|
||||
return this;
|
||||
}
|
||||
[IN(LINE)]
|
||||
public DrawHandler RaycastHit(RaycastHit2D hit)
|
||||
{
|
||||
if (hit.collider != null)
|
||||
{
|
||||
DotDiamond(hit.point);
|
||||
RayArrow(hit.point, hit.normal);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
[IN(LINE)]
|
||||
private void RaycastHit_Internal(float offsetZ, RaycastHit2D hit)
|
||||
{
|
||||
DotDiamond(new Vector3(hit.point.x, hit.point.y, offsetZ));
|
||||
RayArrow(new Vector3(hit.point.x, hit.point.y, offsetZ), hit.normal);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region Raycast
|
||||
[IN(LINE)] public DrawHandler Raycast(Ray ray, RaycastHit hit) => Raycast(ray.origin, ray.direction, hit);
|
||||
[IN(LINE)]
|
||||
@ -143,7 +127,27 @@ namespace DCFApixels
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
#endif
|
||||
|
||||
#if DEBUGX_ENABLE_PHYSICS2D
|
||||
#region RaycastHit2D
|
||||
[IN(LINE)]
|
||||
public DrawHandler RaycastHit(RaycastHit2D hit)
|
||||
{
|
||||
if (hit.collider != null)
|
||||
{
|
||||
DotDiamond(hit.point);
|
||||
RayArrow(hit.point, hit.normal);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
[IN(LINE)]
|
||||
private void RaycastHit_Internal(float offsetZ, RaycastHit2D hit)
|
||||
{
|
||||
DotDiamond(new Vector3(hit.point.x, hit.point.y, offsetZ));
|
||||
RayArrow(new Vector3(hit.point.x, hit.point.y, offsetZ), hit.normal);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Raycast2D
|
||||
[IN(LINE)] public DrawHandler Raycast2D(Ray ray, RaycastHit2D hit) => Raycast2D(ray.origin, ray.direction, hit);
|
||||
@ -238,6 +242,7 @@ namespace DCFApixels
|
||||
return this;
|
||||
}
|
||||
#endregion
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
Shader "Unlit/FakeLighth"
|
||||
Shader "DCFApixels/DebugX/Samples/FakeLighth"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
Shader "Custom/FakeLitShader"
|
||||
Shader "DCFApixels/DebugX/Samples/FakeLitShader"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ Material:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Skybox
|
||||
m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Shader: {fileID: 4800000, guid: 2e981515bbfd59549a1c8fce06a0e033, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords: []
|
||||
@ -128,6 +128,7 @@ Material:
|
||||
- _EmissionEnabled: 0
|
||||
- _EnableExternalAlpha: 0
|
||||
- _EnvironmentReflections: 1
|
||||
- _Factor: -10
|
||||
- _FlipbookMode: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
@ -137,6 +138,7 @@ Material:
|
||||
- _Metallic: 0
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Offset: -0.56
|
||||
- _Parallax: 0.02
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 0
|
||||
@ -157,6 +159,7 @@ Material:
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.29222006, g: 0.20719118, b: 0.4528302, a: 1}
|
||||
- _ButtomColor: {r: 0.0427198, g: 0.025097892, b: 0.11320752, a: 1}
|
||||
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
|
||||
- _Color: {r: 0.0327363, g: 0.031372547, b: 0.13333334, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
@ -164,5 +167,6 @@ Material:
|
||||
- _RendererColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
|
||||
- _SpecColor: {r: 0.19999993, g: 0.19999993, b: 0.19999993, a: 0}
|
||||
- _TopColor: {r: 0, g: 0.25344214, b: 0.6698113, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
||||
|
56
Samples/Other/Skybox.shader
Normal file
56
Samples/Other/Skybox.shader
Normal file
@ -0,0 +1,56 @@
|
||||
Shader "DCFApixels/DebugX/Samples/Skybox"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_TopColor ("Top Color", Color) = (1,1,1,1)
|
||||
_ButtomColor ("Buttom Color", Color) = (1,1,1,1)
|
||||
_Factor ("Factor", Float) = 1
|
||||
_Offset ("Offset", Float) = 1
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Tags { "RenderType"="Opaque" }
|
||||
LOD 100
|
||||
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert
|
||||
#pragma fragment frag
|
||||
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
struct appdata
|
||||
{
|
||||
float4 vertex : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct v2f
|
||||
{
|
||||
float2 uv : TEXCOORD0;
|
||||
float4 vertex : SV_POSITION;
|
||||
};
|
||||
|
||||
float4 _TopColor;
|
||||
float4 _ButtomColor;
|
||||
float _Factor;
|
||||
float _Offset;
|
||||
|
||||
v2f vert (appdata v)
|
||||
{
|
||||
v2f o;
|
||||
o.vertex = UnityObjectToClipPos(v.vertex);
|
||||
o.uv = v.uv;
|
||||
return o;
|
||||
}
|
||||
|
||||
fixed4 frag (v2f i) : SV_Target
|
||||
{
|
||||
fixed4 color = lerp(_ButtomColor, _TopColor, clamp(i.uv.y / _Factor + 0.5 + _Offset, 0, 1));
|
||||
return color;
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
9
Samples/Other/Skybox.shader.meta
Normal file
9
Samples/Other/Skybox.shader.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e981515bbfd59549a1c8fce06a0e033
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -23,6 +23,7 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
#if DEBUGX_ENABLE_PHYSICS2D
|
||||
int i = 0;
|
||||
const float RADIUS_M = 0.5f;
|
||||
|
||||
@ -49,6 +50,7 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
ray = new Ray(point.position, point.forward);
|
||||
hit = Physics2D.CapsuleCast(ray.origin, point.localScale, CapsuleDirection2D.Vertical, point.eulerAngles.z, ray.direction, float.PositiveInfinity, int.MaxValue);
|
||||
DebugX.Draw(GetColor(point)).CapsuleCast2D(ray, point.eulerAngles.z, point.localScale, CapsuleDirection2D.Vertical, hit);
|
||||
#endif
|
||||
}
|
||||
private Color GetColor(Transform pos1)
|
||||
{
|
||||
|
@ -9,6 +9,8 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
public float GradientMultiplier = 5;
|
||||
public Transform[] Points;
|
||||
|
||||
|
||||
|
||||
#if UNITY_EDITOR
|
||||
private void OnDrawGizmos()
|
||||
{
|
||||
@ -23,6 +25,7 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
|
||||
private void Draw()
|
||||
{
|
||||
#if DEBUGX_ENABLE_PHYSICS3D
|
||||
int i = 0;
|
||||
const float RADIUS_M = 0.5f;
|
||||
|
||||
@ -51,6 +54,7 @@ namespace DCFApixels.DebugXCore.Samples
|
||||
Vector3 point2 = ray.origin + point.up * point.localScale.y * RADIUS_M * -0.5f;
|
||||
Physics.CapsuleCast(point1, point2, point.localScale.x * RADIUS_M, ray.direction, out hit, float.PositiveInfinity, int.MaxValue, QueryTriggerInteraction.UseGlobal);
|
||||
DebugX.Draw(GetColor(point)).CapsuleCast(point1, point2, ray.direction, point.localScale.x * RADIUS_M, hit);
|
||||
#endif
|
||||
}
|
||||
private Color GetColor(Transform pos1)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
"displayName": "DebugX",
|
||||
"description": "",
|
||||
"unity": "2021.3",
|
||||
"version": "0.8.7",
|
||||
"version": "0.8.9",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/DCFApixels/DebugX.git"
|
||||
|
Loading…
Reference in New Issue
Block a user