Search Unity

  1. Curious about what's going to be in 2021.1? Have a look at the 2021.1 beta blog post.
    Dismiss Notice
  2. The Burst compiler has its own forum section now.
    Dismiss Notice

Recommended way of getting a single result out of a job?

Discussion in 'Data Oriented Technology Stack' started by 5argon, May 14, 2018.

  1. 5argon


    Jun 10, 2013
    I have went through all the C# Jobs cook book, ECS samples, and ECS classic/hybrid/pure. One thing I am wondering is that when making a job without ECS, how should I get the result of running a job out as a simple value? An example of this kind of job is finding the next prime of an input prime number.

    Currently what I see :
    - Using TransformAccess - Only if the output of computation is a transform
    - Using NativeArray<T> allocated at managed side - Memory is connected so we could read it after .Complete but for multiple values.
    - ECS ComponentSystem : Save computation output values via ComponentDataArray/Inject
    - ECS JobComponentSystem : Same but a job is modifying the data
    - IJobProcessComponentData : Modify component data directly.

    Currently I allocate many NativeArray of size 1 named like "output" and give it to the job and prepare to read it back, then dispose it. But it does not seems like the correct way seeing that it is an "Array".

    As a side question why `bool` prints "not blittable" error when put in `IComonentData` while `bool1` is usable? Also is there any way of putting a string inside `IComponentData` maybe as a fixed size character array? Or I must use series of int to represent each character?
  2. eizenhorn


    Oct 17, 2016