#if UNITY_EDITOR using Unity.Burst; using Unity.Entities; using Unity.Mathematics; using UnityEngine; namespace GarmentButton.PathFinding { [BurstCompile] public partial struct DebugPathSystem : ISystem { [BurstCompile] public void OnCreate(ref SystemState state) { state.RequireForUpdate(); state.RequireForUpdate(); state.RequireForUpdate(); } public void OnUpdate(ref SystemState state) { var grid = SystemAPI.GetSingleton(); var debug = new DebugBox(); foreach (var pathElement in SystemAPI.Query>()) { float3 currentPosition = float3.zero; foreach (var element in pathElement) { var point = grid.Value.Value.Array[element.IndexGrid]; var newPosition = new float3(point.X, point.Y, point.Z) / 10; debug.Draw(newPosition, 0.6f, Color.red); if (!currentPosition.Equals(float3.zero)) { Debug.DrawLine(currentPosition + new float3(0, 0.5f, 0), newPosition + new float3(0, 0.5f, 0), Color.yellow); } currentPosition = newPosition; } } } } } #endif