Code/BoBiCo Soft-Physics/Components/BoBiCoSoftBoneColliderGroup.cs

Component used in editor and runtime that groups GameObjects containing BoBiCoSoftBoneCollider components. It stores a list of collider GameObjects and has a CollectColliders method that gathers valid, enabled BoBiCoSoftBoneCollider components into an output list while avoiding duplicates via a seen set.

Reflection
//=========================================================================================================================
// BoBiCo Soft-Bone Collider Group Component
//=========================================================================================================================

using System.Collections.Generic;

[Title( "SoftBone Collider Group" )]
[Category( "BoBiCo" )]
[Icon( "category" )]
[HelpUrl( "https://bobico-lab.vercel.app/softbone-docs/bobico-softbones/core-components/softbone-collider-group" )]
public sealed class BoBiCoSoftBoneColliderGroup : Component, Component.ExecuteInEditor
{

//=========================================================================================================================
// Group Setup
//=========================================================================================================================

	/// <summary>
	/// List of colliders that are part of this group. These colliders will be used for collision detection with soft-bone chains.
	/// </summary>
	[Property, Title( "Colliders" ), Group( "Colliders" )]
	public List<GameObject> Colliders { get; set; } = new();

    // Collect all valid colliders from the group and add them to the output list, avoiding duplicates using the seen set.
	public void CollectColliders( List<BoBiCoSoftBoneCollider> output, HashSet<BoBiCoSoftBoneCollider> seen )
	{
		if ( !Enabled || Colliders is null )
			return;

		foreach ( var colliderObject in Colliders )
		{
			if ( colliderObject is null || !colliderObject.IsValid() )
				continue;

			var collider = colliderObject.GetComponent<BoBiCoSoftBoneCollider>();
			if ( collider is not null && collider.Enabled && seen.Add( collider ) )
				output.Add( collider );
		}
	}
}