Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

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:
    3
    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,999
  3. yossi_horowitz_artie

    yossi_horowitz_artie

    Joined:
    Jan 30, 2019
    Posts:
    85
    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.)
     
unityunity