Friflo.Engine.ECS icon indicating copy to clipboard operation
Friflo.Engine.ECS copied to clipboard

How to sort relationship?

Open ShenCiao opened this issue 6 months ago • 1 comments

To build a list-based inventory system, I need to sort items in a specific order. How to set a particular order when using GetIncomingLinks<ParentOf>()?

Of course, I can do this by creating a component with a List<Entity> field, but I guess this is something the Relationships is trying to avoid.

ShenCiao avatar Aug 07 '25 02:08 ShenCiao

Sorting relations is currently not supported. In general it is possible. It would require a

public static class RelationExtensions
{
    public static void SortRelations<TRelation>(this Entity entity) where TRelation : struct, IRelation
    { ... }
}

friflo avatar Aug 10 '25 09:08 friflo