Components/ManualLink.cs

A Component that represents a manual, non-physics link from its owner GameObject to another GameObject stored in the Body property. It destroys the linked Body when this component is destroyed and destroys its owner game object if the Body becomes invalid during updates.

Networking
/// <summary>
/// A non-physics logical link between two GameObjects.
/// Used by the Linker tool to group unconnected objects so the Duplicator
/// treats them as part of the same contraption.
/// </summary>
public sealed class ManualLink : Component
{
	[Property, Sync]
	public GameObject Body { get; set; }

	protected override void OnDestroy()
	{
		if ( Body.IsValid() )
			Body.Destroy();

		base.OnDestroy();
	}

	protected override void OnUpdate()
	{
		if ( !Body.IsValid() )
			DestroyGameObject();
	}
}