codeAPI Reference

s&box LinkedGameObjectBuilder: Connected object collection

calendar_today May 12, 2026 schedule ~1 min read person PatrickJr verified 50

Utility class for collecting connected GameObjects. Used by the Duplicator to find all objects that should be included in a duplication.

Properties

CSHARP
public List<GameObject> Objects { get; }

/// Reject players and any objects with players as descendants. Used by duplicator to avoid duping the player.
public bool RejectPlayers { get; set; } = false;

Methods

CSHARP
/// Adds a GameObject without finding connections. Won't add if invalid, world, or already in list.
public bool Add( GameObject obj )

/// Add a GameObject with all connected GameObjects (via joints, colliders, ManualLink, PhysicsFilter).
public void AddConnected( GameObject source )

/// Remove deleted/destroyed objects from the list.
public void RemoveDeletedObjects()

/// Clear all objects.
public void Clear()

Behavior

AddConnected() recursively follows:

  • Rigidbody joints (Object1, Object2)

  • Collider joints (Object1, Object2)

  • ManualLink components

  • PhysicsFilter components

Skips objects with "world" tag, MapInstance, or players (if RejectPlayers is true).

Usage

Used by the Duplicator to collect all objects in a contraption. Call AddConnected() on the root object to include everything connected via physics or logical links.

Example: Duplicator.AddConnected( selectedProp ) to collect the entire contraption.

Source

Used by Duplicator and tool systems.

Was this helpful?