Search Unity

Documentation is wrong for RaycastCommand...?

Discussion in 'Entity Component System' started by Nyanpas, Jul 31, 2020.

  1. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    406
    Greetings, and observe:
    https://docs.unity3d.com/ScriptReference/RaycastCommand.html

    Code (CSharp):
    1. // Setup the command and result buffers
    2.         var results = new NativeArray<RaycastHit>(1, Allocator.Temp);
    3.  
    4.         var commands = new NativeArray<RaycastCommand>(1, Allocator.Temp);
    Upon doing so, but with 8, instead of 1, Unity 2019.4 screams to me:
    So then I changed from Temp to TempJob, and then the problem was solved.

    Missed I something?
     
  2. desertGhost_

    desertGhost_

    Joined:
    Apr 12, 2018
    Posts:
    260
    Temp ̶c̶a̶n̶ ̶o̶n̶l̶y̶ ̶b̶e̶ ̶u̶s̶e̶d̶ ̶i̶n̶ cannot be passed to a bursted job. TempJob should be used instead; the documentation appears to be incorrect.

    EDIT:

     
    Last edited: Jul 31, 2020
    Nyanpass233 and Nyanpas like this.
  3. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    406
    So how does one use Burst with RaycastCommandoes?
     
  4. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,759
    Tou can use Temp wherever you want, you just can't pass Temp memory to jobs.
     
  5. Nyanpas

    Nyanpas

    Joined:
    Dec 29, 2016
    Posts:
    406
    I gave my camera rig a nice plumage using the RaycastCommand. It was surprisingly easy to set up and use along with other jobs as well. It has one job to calculate the rays that the RaycastCommand-job depends on.

    rayeningser.gif

    However, still not sure if RaycastCommand can be used with Burst as I can't seem to find anything about it...