Nez.Portable/ECS/InternalUtils/EntityList.cs
/// <summary>
/// returns the first Component found in the Scene of type T
/// </summary>
/// <returns>The component of type.</returns>
/// <typeparam name="T">The 1st type parameter.</typeparam>
returns the first Component found in the Scene of type T
returns the first Component found in the Scene of type T
public T findComponentOfType<T>()
            where T : Component
        {
            for (var i = 0; i < _entities.length; i++)
            {
                if (_entities.buffer[i].enabled)
                {
                    var comp = _entities.buffer[i].getComponent<T>();
                    if (comp != null)
                        return comp;
                }
            }
            foreach (var entity in _entitiesToAdd)
            {
                if (entity.enabled)
                {
                    var comp = entity.getComponent<T>();
                    if (comp != null)
                        return comp;
                }
            }
            return null;
        }
public T findComponentOfType < T > ( ) where T : Component { for ( var i = 0 ; i < _entities . length ; i ++ ) { if ( _entities . buffer [ i ] . enabled ) { var comp = _entities . buffer [ i ] . getComponent < T > ( ) ; if ( comp != null ) return comp ; } } foreach ( var entity in _entitiesToAdd ) { if ( entity . enabled ) { var comp = entity . getComponent < T > ( ) ; if ( comp != null ) return comp ; } } return null ; }
returns the first Component found in the Scene of type T
returns the first Component found in the Scene of type T
The component of type.
The component of type .
typeparam
The 1st type parameter.
The 1st type parameter .