Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Request: Non generic EntityQueryBuilder queries

Discussion in 'Entity Component System' started by tertle, Apr 18, 2019.

  1. tertle

    tertle

    Joined:
    Jan 25, 2011
    Posts:
    3,753
    Currently:
    We have generic versions, for example WithAny looks like this.

    Code (CSharp):
    1.         public EntityQueryBuilder WithAny<T0>()
    2.         {
    3.             ValidateHasNoQuery();
    4.             m_Any.Add(TypeManager.GetTypeIndex<T0>());
    5.             return this;
    6.         }
    Request:
    Could we get a non generic (array) version?

    Code (CSharp):
    1.         public EntityQueryBuilder WithAny(Type[] types)
    2.         {
    3.             ValidateHasNoQuery();
    4.  
    5.             for (var i = 0; i < types.Length; i++)
    6.             {
    7.                 m_Any.Add(TypeManager.GetTypeIndex(types[i]));              
    8.             }
    9.          
    10.             return this;
    11.         }
    Reason:
    Would just save me a few lines of code in a single system =)

    Current workaround:
    I just use a .With(EntityQuery) at the moment.
     
    GilCat likes this.