I've been struggling with this for hours and haven't found any solutions online. I've probably missed a tiny step here somewhere.
I have 2 systems in my game right now. A Spawner system who's only purpose is to spawn an empty game object prefab (Entity) in the SubScene and attach the necessary components to it for it to 'construct' itself (Mesh, gameplay data etc)
The second system is that Initialisation System.
The first one as I said works fine, the empty Entity gets instantiated correctly with the correct components.
I've also confirmed it has the correct Aspect related to it.
However, my IJobEntity will not execute on the Instantiated Entity.
The 'Execute' function itself is expecting;
[BurstCompile]
public void Execute([ChunkIndexInQuery] int sortKey, PlayerClassAspect classComponent)
And have confirmed that the Entity does have the PlayerClassAspect attached to it in the inspector.
But it just won't execute. I've also tried replacing the Aspect with just one of the components inside it and still nothing.
For the record the scheduler looks like this;
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
EntityCommandBuffer.ParallelWriter ecb = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>()
.CreateCommandBuffer(state.WorldUnmanaged).AsParallelWriter();
state.Dependency = new InitialisePlayerJob()
{
ecb = ecb
}.ScheduleParallel(state.Dependency);
}
BUT, if I don't instantiate the Entity and instead drag the prefab into the subscene via the editor the Job executes. Is there something I'm missing with how the ECB Instantiates an Entity and for some reason the System isn't detecting these instantiated copies?
Link to Code (Spawning System - working, And the INit System - not working): https://paste.myst.rs/vv0ofe0y
a powerful website for storing and sharing text and code snippets. completely free and open source.