Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug ParallelWritter to methods with codegen inside from OnUpdate (Entities 0.51.0, DOTS team aware)

Discussion in 'Entity Component System' started by eizenhorn, Jun 23, 2022.

  1. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    Just for community to aware (Unity already know and created ticket for that).

    Passing
    ParallelWritter
    to methods with codegen inside (
    Entities.ForEach
    ,
    Job.WithCode
    ) from
    OnUpdate
    will crash ILPP cloner:
    upload_2022-6-23_19-13-44.png

    Simple repro:
    Code (CSharp):
    1.  
    2. public partial class SimpleCompilerCrash : SystemBase
    3. {
    4.    protected override void OnUpdate()
    5.    {
    6.        BreakingMethod(new NativeList<int>(Allocator.Temp).AsParallelWriter());
    7.    }
    8.  
    9.    private void BreakingMethod(NativeList<int>.ParallelWriter listParallel)
    10.    {
    11.        Job.WithCode(() => { }).Schedule();
    12.    }
    13. }
    14.  
    The issue:
    If you look at
    Method candidates are
    you'll see in method signature missed
    .ParallelWriter

    upload_2022-6-23_19-14-55.png

    Workaround:
    Put arguments for method into wrapper struct and pass this struct to method.
     
    Last edited: Jun 23, 2022