forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDecorationRenderSystem.cs
More file actions
31 lines (29 loc) · 1.01 KB
/
Copy pathDecorationRenderSystem.cs
File metadata and controls
31 lines (29 loc) · 1.01 KB
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
31
using Unity.Burst;
using Unity.Entities;
using Unity.Transforms;
using UnityEngine;
namespace Streaming.RuntimeContentManager
{
// render entities that are loaded and should render
[WorldSystemFilter(WorldSystemFilterFlags.Default | WorldSystemFilterFlags.Editor)]
[UpdateInGroup(typeof(PresentationSystemGroup))]
public partial struct DecorationRenderSystem : ISystem
{
[BurstCompile]
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<DecorationVisualComponentData>();
}
public void OnUpdate(ref SystemState state)
{
foreach (var (transform, dec) in
SystemAPI.Query<RefRW<LocalToWorld>, RefRO<DecorationVisualComponentData>>())
{
if (dec.ValueRO.loaded && dec.ValueRO.shouldRender)
{
Graphics.DrawMesh(dec.ValueRO.mesh.Result, transform.ValueRO.Value, dec.ValueRO.material.Result, 0);
}
}
}
}
}