Entities Version .51.1 trouble (And solution)

The current version of entities has been giving me many troubles up to this point ranging from which packages to actually download to code outright not working. One specific problem was when we were implementing “.WithNativeDisableParallelForRestrictions(randomArray)” in the NewDestinationSystem (10:26). The error was saying randomArray needed to be captured inside the lambda then assigned to a local variable which I could then pass into the method in place of randomArray directly. I tried to do this with no success. After many other solution attempts to circumvent the problem I came across something that works despite me not understanding it. In the Core ECS Unity docs under the Accessing Entity Data section there was code snippets involving the “.WithStoreEntityQueryInField()” method. It was in the same section we were placing our method so despite it being different I figured close enough. Instead of doing “Method(variable)” it showed “Method(ref variable)”. After trying to add that solution to the course code (using “in” instead of “ref” to match our code more closely) it gave me an error. HOWEVER when I got rid of the in there was no longer any errors. So I ran it in Unity and everything works fine. I’m really not sure what I did because my code is the same as the course now just with that middle step of adding and getting rid of “in” when passing in randomArray. Hopefully I can save someone hours of work and research with this fix!

1 Like

Privacy & Terms