forked from Unity-Technologies/EntityComponentSystemSamples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigBakingSystem.cs
More file actions
28 lines (25 loc) · 753 Bytes
/
Copy pathConfigBakingSystem.cs
File metadata and controls
28 lines (25 loc) · 753 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
using Unity.Burst;
using Unity.Entities;
namespace Graphical.RenderSwap
{
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
public partial struct ConfigBakingSystem : ISystem
{
[BurstCompile]
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<Config>();
state.RequireForUpdate<ExecuteRenderSwap>();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var config = SystemAPI.GetSingleton<Config>();
state.EntityManager.AddComponent<SpinTile>(config.StateOn);
state.EntityManager.AddComponent<SpinTile>(config.StateOff);
}
}
struct SpinTile : IComponentData
{
}
}