diff --git a/src/ECS/Relations/EntityRelation.cs b/src/ECS/Relations/EntityRelation.cs
index c4230930..a82f5ffe 100644
--- a/src/ECS/Relations/EntityRelation.cs
+++ b/src/ECS/Relations/EntityRelation.cs
@@ -13,7 +13,7 @@ internal EntityRelation(AbstractEntityRelations relations) {
}
///
- /// Returns a collection of entities having one or more relations of the specified type.
+ /// Returns a collection of entities having one or more relation.
/// Executes in O(1).
///
///
@@ -23,15 +23,21 @@ internal EntityRelation(AbstractEntityRelations relations) {
///
/// -
/// To get all entities including their relations (the cartesian product aka CROSS JOIN) use
- ///
+ ///
///
///
///
public EntityReadOnlyCollection Entities => new EntityReadOnlyCollection(relations.store, relations.positionMap.Keys);
///
- /// Iterates all entity relations of the specified type.
+ /// Iterates all entity relations.
/// Executes in O(N) N: number of all entity relations.
///
public void For(ForEachEntity lambda) => relations.ForAllEntityRelations(lambda);
+
+ ///
+ /// Return all entity relations as pairs. A pair is (entities[i], relations[i])
+ /// Executes in O(1). Most efficient way to iterate all entity relations.
+ ///
+ public (Entities entities, Chunk relations) Pairs => relations.GetAllEntityRelations();
}
diff --git a/src/ECS/Relations/RelationExtensions.cs b/src/ECS/Relations/RelationExtensions.cs
index ffce148b..c9ea3bc4 100644
--- a/src/ECS/Relations/RelationExtensions.cs
+++ b/src/ECS/Relations/RelationExtensions.cs
@@ -121,7 +121,7 @@ public static EntityRelation EntityRelation(this EntitySto
///
/// -
/// To get all entities including their relations (the cartesian product aka CROSS JOIN) use
- ///
+ ///
///
///
///
@@ -147,9 +147,11 @@ public static void ForAllEntityRelations(this EntityStore store, ForE
}
///
+ /// Obsolete: Use
/// Return all entity relations of the specified type.
/// Executes in O(1). Most efficient way to iterate all entity relations.
///
+ [Obsolete("replace with property: EntityRelation().Pairs")]
public static (Entities entities, Chunk relations) GetAllEntityRelations(this EntityStore store)
where TRelation : struct, IRelation
{
diff --git a/src/Tests/ECS/Relations/Test_Relations_Delete.cs b/src/Tests/ECS/Relations/Test_Relations_Delete.cs
index a13dc353..dfcdad06 100644
--- a/src/Tests/ECS/Relations/Test_Relations_Delete.cs
+++ b/src/Tests/ECS/Relations/Test_Relations_Delete.cs
@@ -39,7 +39,7 @@ public static void Test_Relations_Delete_int_relations()
AreEqual(3, count);
// --- version: get all entity relations in O(1)
- var (entities, relations) = store.GetAllEntityRelations();
+ var (entities, relations) = store.EntityRelation().Pairs;
AreEqual("{ 1, 1, 2 }", entities.Debug());
AreEqual("{ 10, 20, 30 }", relations.Debug());
@@ -86,7 +86,7 @@ public static void Test_Relations_Delete_Entity_relations()
AreEqual(3, count);
// --- version: get all entity relations in O(1)
- var (entities, relations) = store.GetAllEntityRelations();
+ var (entities, relations) = store.EntityRelation().Pairs;
AreEqual("{ 1, 1, 2 }", entities.Debug());
AreEqual("{ 10, 11, 12 }", relations.Debug());
diff --git a/src/Tests/ECS/Relations/Test_Relations_Query.cs b/src/Tests/ECS/Relations/Test_Relations_Query.cs
index 7ecffd12..730a02d5 100644
--- a/src/Tests/ECS/Relations/Test_Relations_Query.cs
+++ b/src/Tests/ECS/Relations/Test_Relations_Query.cs
@@ -222,7 +222,7 @@ public static void Test_Relations_GetAllEntityRelations_Perf()
int count = 0;
var sw = new Stopwatch();
sw.Start();
- var (entities, relations) = store.GetAllEntityRelations();
+ var (entities, relations) = store.EntityRelation().Pairs;
int length = entities.Count;
for (int n = 0; n < length; n++) {
count++;