#Suggestion: EntityQueryBuilder.BuildAndDispose

1 messages · Page 1 of 1 (latest)

outer moon
#

To allow for easy fluent building and disposal I suggest to add BuildAndDispose(...) methods to EntityQueryBuilder, e.g.

var query = new EntityQueryBuilder(Allocator.Temp) .WithAll<ComponentA, ComponentB>() .BuildAndDispose(ref state);

proud jetty
#

using var query = ...
is a more c# way of handling this

outer moon
proud jetty
#

oh sure, but do you ever actually need to dispose your builder?

#

when do you not use temp

outer moon
#

True, it's just not overly obvious whether Dispose is optional or not, particularly seeing as CollectionHelper.ShouldDeallocate(Allocator.Temp) returns true 🙂

proud jetty
#

(legit question, i have never seen someone do it but there might be actual use cases)