using Unity.Burst; using Unity.Entities; using Unity.Mathematics; using UnityEngine; namespace GarmentButton.PathFinding.Editor { [BurstCompile] public partial struct DebugPointInGridSystem : ISystem { [BurstCompile] public void OnCreate(ref SystemState state) { state.RequireForUpdate(); state.RequireForUpdate(); } [BurstCompile] public void OnUpdate(ref SystemState state) { var grid = SystemAPI.GetSingleton().Value; var entity = SystemAPI.GetSingletonEntity(); var index = SystemAPI.GetSingleton().Index; var point = grid.Value.Array[index]; var position = new float3(point.X, point.Y, point.Z) / 10; Debug.Log($"Value = {index}, Position = {position}"); Debug.DrawLine(position, position + new float3(0, 50, 0), Color.red, 50); state.EntityManager.DestroyEntity(entity); } } }