Wondering if someone could help me out.
I have a GameObjectConversionSystem with live link that create an entity and adds a component tag “TagBuild”
....
var e = this.GetPrimaryEntity(data);
var tag = new TagBuild { };
this.DstEntityManager.AddComponentData(e, tag);
....
and a componentSystem that uses that entiy then remove the tag
....
Entities.ForEach((Entity entity, ref TagBuild tag) =>
{
// do stuff ...
// remove TagBuild
EntityManager.RemoveComponent(entity, typeof(TagBuild));
});
....
When i ran the game I get the expected behavior , the Component system runs once since it removes the tag.
But when I change something on my game object while the game is running I see the GameObjectConversionSystem , creating the entity wit the tag but my Component system does not run. It look like when I remove the tag componet the component sys never runs again. What im i missing here.
francois85:
Wondering if someone could help me out.
I have a GameObjectConversionSystem with live link that create an entity and adds a component tag “TagBuild”
....
var e = this.GetPrimaryEntity(data);
var tag = new TagBuild { };
this.DstEntityManager.AddComponentData(e, tag);
....
and a componentSystem that uses that entiy then remove the tag
....
Entities.ForEach((Entity entity, ref TagBuild tag) =>
{
// do stuff ...
// remove TagBuild
EntityManager.RemoveComponent(entity, typeof(TagBuild));
});
....
When i ran the game I get the expected behavior , the Component system runs once since it removes the tag.
But when I change something on my game object while the game is running I see the GameObjectConversionSystem , creating the entity wit the tag but my Component system does not run. It look like when I remove the tag componet the component sys never runs again. What im i missing here.
Are you sure that your next entities with TagBuild in the same world?
Yea I can see them in the default world. I ended up dropping the tag components and used a SetFilter. Seems to work
Thanks for the reply
I keep running into jobs not executing after I change something on my game object, how do I check if an entity is in the same world.
for example Test only runs once but SetTiles will keep running after I change a value on my game object. This is driving me insane.
// TEST
[BurstCompile]
struct TEST : IJobForEach<PlanetSizeComponents>
{
public void Execute([ReadOnly] ref PlanetSizeComponents ps)
{
DebugInfo();
}
[BurstDiscard]
private void DebugInfo()
{
Debug.Log("<b> <size=13> <color=red>Info: PlanetCreateMeshSystem : TEST.</color> </size> </b>");
}
}
/// <summary>
///
/// </summary>
// ToDo : [BurstCompile] Not supported with EntityCommandBuffer
struct SetTiles : IJobForEach_B<TilesBufferComponent>
{
public EntityCommandBuffer.Concurrent ecb;
[DeallocateOnJobCompletion]
public NativeArray<Entity> eTiles;
public void Execute([ReadOnly] DynamicBuffer<TilesBufferComponent> b)
{
DebugInfo();
for (int i = 0; i < b.Length; i++)
{
Entity e = eTiles[i];
ecb.SetComponent<TilePositionComponents>(i, e, new TilePositionComponents
{
Position = new float3(b[i].PositionX,
b[i].PositionY,
b[i].PositionZ)
});
//ecb.SetComponent<TileIDComponents>(i, e, new TileIDComponents
//{
// Id = i
//});
}
}
[BurstDiscard]
private void DebugInfo()
{
Debug.Log("<b> <size=13> <color=green>Info : PlanetSetTileDataSystem : SetTiles 1.</color> </size> </b>");
}
}
//...
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
//TEST
inputDeps = new TEST()
{
}.ScheduleSingle(this, inputDeps);
inputDeps = new SetTiles()
{
ecb = ecbs.CreateCommandBuffer().ToConcurrent(),
eTiles = qTiles.ToEntityArray(Allocator.TempJob)
}.ScheduleSingle( qTileBuffer, inputDeps);
In EntityDebugger - easiest way.