Search Unity

Entities.Foreach 'in' parameter in lambda shows ReadWrite dependency

Discussion in 'Entity Component System' started by kleicht, Dec 2, 2019.

  1. kleicht

    kleicht

    Joined:
    Aug 1, 2018
    Posts:
    16
    I started to convert the old GetEntityQuery + explicit Job declaration structure to the new Entities.Foreach + With builder version and I noticed that even though the lamba parameter has 'in' modifier the EntityDebugger window still shows that the component has ReadWrite dependency.

    Is that the correct behaviour?
    Should we keep using the explicit version when we want a ReadOnly behaviour?

    Picture was taken from the Samples/HelloCube/1. Foreach script.

    upload_2019-12-2_13-45-2.png
     
  2. fellowunitydeveloper

    fellowunitydeveloper

    Joined:
    Oct 23, 2019
    Posts:
    7
    I believe it's a bug with the Entity Debugger. If you check the generated code for the job with IL Spy it will have the ReadOnly attribute in the second parameter.
     
    mkracik, Singtaa and kleicht like this.