forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSplineDebugRenderingSystem.cs
More file actions
30 lines (28 loc) · 833 Bytes
/
Copy pathSplineDebugRenderingSystem.cs
File metadata and controls
30 lines (28 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Unity.Burst;
using Unity.Entities;
using UnityEngine;
namespace Graphical.Splines
{
[WorldSystemFilter(WorldSystemFilterFlags.Editor)]
public partial struct SplineDebugRenderingSystem : ISystem
{
[BurstCompile]
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<ExecuteSplines>();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
foreach (var spline in
SystemAPI.Query<RefRO<Spline>>())
{
ref var points = ref spline.ValueRO.Data.Value.Points;
for (int i = 0; i < points.Length - 1; i += 1)
{
Debug.DrawLine(points[i], points[i + 1], Color.magenta);
}
}
}
}
}