Skip to content

Commit

Permalink
Update EntityComponentCollection.cs
Browse files Browse the repository at this point in the history
added GetUnsafe to EntityComponentCollection.cs to get interfaces
  • Loading branch information
ch3mbot committed Sep 16, 2023
1 parent 95da7ce commit 8f034d1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sources/engine/Stride.Engine/Engine/EntityComponentCollection.cs
Expand Up @@ -57,6 +57,18 @@ internal EntityComponentCollection(Entity entity)
return null;
}

public T? GetUnsafe<T>()
{
for (int i = 0; i < Count; i++)
{
if (this[i] is T item)
{
return item;
}
}
return null;
}

/// <summary>
/// Gets the index'th component of the specified type or derived type.
/// </summary>
Expand Down

0 comments on commit 8f034d1

Please sign in to comment.