Hi, I'm new to DOTS and one thing that I haven't been able to found anywhere is the equivalent of start/awake. I haven't found a default system group that does that so I created my own but its a bit... wonky. Creating 2 system groups that execute one after another once is easy but where it gets more complicated is how to make sure these will execute before the first simulation update. I haven't been able to put them in the initialization system group as entities don't yet exist and I for some reason couldn't make them execute before any of the subgroups of the simulation group. Anyway, here's my code and if anyone can advice me on how to make it cleaner, thanks!
using Unity.Entities;
namespace UnityEngine {
[UpdateInGroup(typeof(InitializationSystemGroup))]
public partial class BlockingSystemGroup :SystemBase {
protected override void OnUpdate()
{
World.GetExistingSystemManaged<SimulationSystemGroup>().Enabled=false;
World.GetExistingSystemManaged<BlockingSystemGroup>().Enabled=false;
}
}
[UpdateInGroup(typeof(PresentationSystemGroup))]
public partial class StartingSystemGroup :ComponentSystemGroup {
protected override void OnUpdate()
{
base.OnUpdate();
World.GetExistingSystemManaged<SimulationSystemGroup>().Enabled=true;
World.GetExistingSystemManaged<StartingSystemGroup>().Enabled=false;
}
}
[UpdateInGroup(typeof(StartingSystemGroup))]
[UpdateBefore(typeof(StartSystemGroup))]
public partial class AwakeSystemGroup : ComponentSystemGroup {
protected override void OnUpdate()
{
base.OnUpdate();
}
}
[UpdateInGroup(typeof(StartingSystemGroup))]
public partial class StartSystemGroup : ComponentSystemGroup {
protected override void OnUpdate()
{
base.OnUpdate();
}
}
}