#ToComponentDataListAsync<T1, T2, ...>

1 messages · Page 1 of 1 (latest)

high hemlock
#

Given that EntityQuery.ToComponentDataListAsync is often called multiples times for each different type in the same query wouldn't it be good for Unity to provide a ToComponentDataListAsync<T1, T2, ...> that returns multiple arrays in a single method call? Esentially turn this var first = query.ToComponentDataListAsync<Component1>(WorldUpdateAllocator, out var handle1); var second = query.ToComponentDataListAsync<Component2>(WorldUpdateAllocator, out var handle2); var third = query.ToComponentDataListAsync<Component3>(WorldUpdateAllocator, out var handle3); into this: var (first, second, third) = query.ToComponentDataListAsync<Component1, Component2, Component3>(WorldUpdateAllocator, out var handle);

native ledge
#

I'd be reluctant to add a wrapper for something that could just as easily be implemented using the public API, unless the wrapper can somehow be implemented significantly more efficiently using internal functionality. Off the top of my head, I'm not clear on how a multi-type ToComponentDataListAsync() would be anything better than "for each type, allocate the output array and schedule a job to fill it". Is there potential for more efficient batching that you have in mind?

high hemlock
#

Just that I noticed I often call ToComponentDataListAsync multiple times on the same query, so I thought it'd be neat to have such overloads