Skip to main content

Socket Editor

The socket editor changes the sockets of a prefab: add new ones, move or turn them, and delete them. A change applies to every copy of that prefab.

Edit a prefab's sockets​

Sockets must be shown: while they are hidden, the Sockets panel says so, and you cannot click sockets in the scene.

  1. Turn on the Show sockets button on the transform widget.
  2. Select one prefab.
  3. In the Sockets panel of the Inspector, 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.

A prefab without sockets has no Sockets panel. To give it sockets, click the ⋮ button on the name row at the top of the Inspector, then click Add Sockets. The socket editor opens.

warning

The socket editor has no undo. Revert reads the edited prefab's sockets from the socket files again: its unsaved changes are lost, and other prefabs keep theirs. 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 this prefab's sockets from the socket files again. Its unsaved socket changes are lost. Other prefabs keep theirs.

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 panel says 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 opacity, 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.