Search Unity

Interesting behaviour in the Job System and EntityCommandBuffer issues

Discussion in 'Project Tiny' started by tomy93, Aug 1, 2019.

  1. tomy93

    tomy93

    Joined:
    May 31, 2017
    Posts:
    2
    I'm getting the exception `EntityCommandBuffer.Concurrent must only be used in a Job` (EntityCommandBuffer.cs line 1542) when trying to get EntityCommandBuffer.Concurrent from within a Job (which is needed to use some basic features as AddComponent<>/RemoveComponent<>).

    Doing some quick inspection into the source code, we can suspect that the Tiny Job System is not actually doing real jobs and it might be single-thread instead.

    What's going on with the current Tiny Job System? Is there any workaround to get access to the EntityCommandBuffer from within a Job?
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    1,366
  3. yossi_horowitz_artie

    yossi_horowitz_artie

    Joined:
    Jan 30, 2019
    Posts:
    56
    This happens with any usage of `EntityCommandBuffer.Concurrent` in a job in Tiny -- we've got probably dozens examples of `IForEachWithEntity` jobs that use `EntityCommandBuffer.Concurrent` and work fine in ordinary ECS but yield the exception which @tomy93 mentioned when run in Tiny.

    (We're working on a unified codebase for Tiny-based and app-based projects, which is the main reason we started using ECS in the first place.)