Skip to content

Remove extra foreach with world data#31

Open
CanYouCatchMe01 wants to merge 9 commits intoPeteyChan:masterfrom
CanYouCatchMe01:remove-extra-foreach
Open

Remove extra foreach with world data#31
CanYouCatchMe01 wants to merge 9 commits intoPeteyChan:masterfrom
CanYouCatchMe01:remove-extra-foreach

Conversation

@CanYouCatchMe01
Copy link

I removed all Foreach functions that use world data. It felt like there were many copy-past functions that were not really needed. They made the QueryForeachFunctions.cs file very long. For example:

public void Foreach<W1, C1>(in w1c1_query<W1, C1> action)
{
     // ...
}

It is instead possible to just get the world data outside the Foreach, and basically get the same functionally.

A world_data_value = world.GetData<A>();

query.Foreach((Entity entity, ref int value) =>
{
    Console.WriteLine($"{entity} value is {world_data_value.x}");
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant