Skip to main content

Sockets

Sockets are points on a prefab where it joins another prefab, such as the ends of a road piece, a tunnel or a pipe. Drag one socket onto another and RustEdit moves the prefab so the two pieces meet exactly. The two prefabs then stay linked: when you move one, the other moves with it.

Two road pieces joined at their sockets: the linked pair in purple in the middle, a free socket in blue at the end

Which prefabs have sockets​

RustEdit comes with sockets for about 380 Rust prefabs, including:

  • roads, rail tracks and train tunnels
  • tunnels, tunnel links and stations
  • caves, sewers, pipelines and pipes
  • the timber mine, bunker rooms and perimeter walls
  • building foundations, floors, walls and stairs

You can give any other prefab sockets with the socket editor.

Show sockets​

Click the sockets button (the socket icon) on the transform widget in the scene view. Its tooltip starts with "Show sockets". Click it again to hide them. RustEdit remembers the setting.

The transform widget with the Sockets button marked

Links keep working while sockets are hidden: linked prefabs still move together.

What the markers mean​

MarkerMeaning
Light blue dot and ringA free socket. The color is the socket's type color; built-in sockets are light blue.
Blue arrowThe way the socket faces: out of the prefab, toward the piece it joins.
Green lineThe socket's up direction.
Purple dot and ringTwo linked sockets. A link is drawn as one marker.
Red dot and ring with a red lineA link whose sockets no longer meet.
Orange ringThe active socket: the one you clicked last.
White ring and a labelThe socket under the pointer, with its name and type.

Markers keep the same size on the screen and fade out far from the camera. Sockets of hidden prefabs are not drawn.

Connect two prefabs​

  1. Turn on the sockets button on the transform widget.
  2. Place the two prefabs near each other.
  3. Point at a free socket of the prefab you want to move.
  4. Hold the left mouse button and drag onto a free socket of the other prefab. Sockets that cannot join dim while you drag.
  5. Release the button. The prefab you dragged from (and everything already linked to it) moves and turns so the two sockets meet. The other prefab does not move. The sockets turn purple, and the notifications say "Connected the sockets".

To cancel a drag, press the right mouse button or Esc. Each connect is one undo step.

tip

To connect, you drag from a free socket. To move a socket that is already linked, disconnect it first.

Disconnect​

  • Alt and click a linked socket to break its link.
  • Or select the prefab and click Disconnect in the Sockets panel of the Inspector.

Move linked prefabs​

Linked prefabs move as one piece. When you move or turn a prefab, everything linked to it, directly or through other links, moves with it. This works for the gizmo, typed values in the Inspector, Snap to Ground and the other move tools.

  • To move one prefab on its own, turn on Move Individually in the Sockets panel. Links between the moved prefabs and the ones left behind break when you start the move. Undo brings them back.
  • Linked prefabs cannot be scaled. Turn on Move Individually to scale one on its own.
  • If a prefab in the group is locked, nothing in the group can move.
  • Click Select Connected in the Sockets panel to select every prefab joined to the selection.

Turn a linked piece (Spin)​

Some sockets can join at more than one angle, for example square pieces that fit at every 90 degrees. Click the linked socket to make it active, then click Spin in the Sockets panel. The piece on that side of the link turns by one step around the socket. Spin does not work on a link that is part of a loop.

Links are saved in the scene file. They are not in the exported map: Rust does not use them. Copies made with Duplicate keep the links between the copies. When you delete a linked prefab and undo, its links come back.

If a saved link's prefab or socket is gone (for example, a socket was renamed in a socket file), the link is dropped when the scene opens, and a warning says how many.

Edit a prefab's sockets​

You can add, move, turn and delete the sockets of any prefab. The change applies to every copy of that prefab.

  1. Turn on the sockets button on the transform widget. The Sockets panel only shows while sockets are shown.
  2. Select one prefab.
  3. In the Sockets panel, click Edit Sockets. The socket editor opens. The selection is locked, and the move and rotate gizmo now works on the active socket.
  4. Click a socket in the scene to pick it, or click Add Socket to add one in the middle of the prefab.
  5. Move and turn the socket with the gizmo, or type its Position and Rotation.
  6. Set its Name, Type and Roll Step if you need to.
  7. Click Save.
  8. Click Stop Editing, or press Esc.
warning

The socket editor has no undo. Revert reads all socket files again, which throws away unsaved socket changes on every prefab. If you close the editor without saving, the changes stay until you reload the socket files or restart RustEdit, and they are then lost.

Socket editor fields​

FieldWhat it does
NameThe socket's name. Links find their socket by name.
TypeSockets connect when their types allow it. The default type connects to everything.
PositionPosition in the prefab's space.
RotationRotation in the prefab's space. The socket's forward axis points out of the prefab.
Roll StepAbove 0, the socket can join at every multiple of this many degrees around its forward axis. 0 to 180.
Add SocketAdds a socket in the middle of the prefab.
Delete SocketDeletes the active socket and its links.
SaveWrites this prefab's sockets to its socket file.
RevertReads the socket files again. Unsaved socket changes are lost.

Socket files​

Socket definitions are JSON files in the Configuration/sockets folder next to the app.

  • default.json holds the built-in sockets. RustEdit replaces it when a new version has newer built-in sockets, and keeps the old one as default.json.bak. Do not edit it.
  • The socket editor saves your changes to custom.json (or to the file the prefab's sockets came from, when that is not default.json).
  • Other .json files load after default.json, in name order. A later file replaces a prefab's whole socket list.

After you edit a socket file by hand, click EditReload Socket Files. The notifications say how many prefabs and sockets were loaded.

A socket file looks like this:

{
"version": 1,
"types": {
"pipe": { "color": "1 0.5 0 1", "connects": [ "pipe" ] }
},
"prefabs": {
"assets/bundled/prefabs/example/pipe_straight.prefab": [
{ "name": "front", "type": "pipe", "position": "0 0 4", "rotation": "0 0 0", "rollStep": 90 },
{ "name": "back", "type": "pipe", "position": "0 0 -4", "rotation": "0 180 0", "rollStep": 90 }
]
}
}
  • types: each type has a color (red, green, blue and alpha, 0 to 1) and the types it connects to. "*" connects to every type. Two sockets can join when either type lists the other. The built-in default type connects to everything.
  • prefabs: the full prefab path, then its sockets. type can be left out (it is then default), and so can rollStep (0).
  • Numbers in position, rotation and color are written with spaces between them, and with a dot as the decimal mark on every computer. A file written with decimal commas by an older version still reads.

Settings​

Under Sockets in the settings:

SettingWhat it does
Draw DistanceHow far from the camera sockets are drawn, in meters. 10 to 2000, default 150.
Handle SizeThe size of the socket markers on the screen, in pixels. 4 to 48, default 16.

Building blocks​

The Building tool snaps building blocks with Rust's own building sockets, not with these sockets, and it does not link them. Placed blocks still show their free sockets, often two at the same spot. Building blocks only move together if you link them yourself.