Skip to content

Parts and assets ​

PartBuilder ​

Call mod.Parts.Create(name) to get a builder for your namespace. Register() validates and returns the immutable PartDefinition. First-mod example

MembersBehaviour
WithName, WithDescription, WithLocalizationSet display text and optional name and description keys.
WithModel, WithIconSelect a required model and an optional inventory or build icon.
WithSize, WithMass, WithResistanceSet positive finite dimensions and mass, and optionally override collision resistance. Size defaults to one metre on each axis and mass defaults to one.
WithCategory, WithCost, RequiresResearchSet a build tab, add a solid item cost, or add a prerequisite. The default is the StellarWorks build tab.
WithPlacement, WithCollider, WithSocketSet the placement surface and geometry.
WithJigsawPoint, WithJigsawNode, WithSocketRelayAdd placement endpoints and native connections.
WithNativeStorageEnables stock ten-slot chest storage. On authority it is available through PartContext.Inventory.
AddComponent, WithMetadataAttach registered behaviour and store structured definition metadata.

Placement and geometry ​

TypeFields and constraints
BoxColliderDefinitionSize, Center, optional Node. Use 1–64 explicit boxes. A named node must resolve uniquely in the model.
PlacementSurfaceFloor (default), Wall, Any, Jigsaw. A named mount must reference a declared structural socket.
SocketDefinitionUnique local ID, SocketKind, position, optional slot and rotation. Structural sockets omit the slot. Cable sockets use distinct slots 0..n-1.
SocketRelayTwo distinct power sockets or two distinct fluid sockets, each used in at most one relay.
JigsawEndpointDefinitionShared match ContentId, local position, optional orientation, ForcedRollDegrees, and ExtendChainOnAim. Jigsaw placement requires a node. Only one chain continuation is allowed per match ID on a part.

Author transforms in imported model coordinates in metres before applying the selected mount. PartContext.Sockets exposes resolved sockets on an active instance. Model and placement guide

Assets ​

AssetReference(owner, path) identifies a relative asset. Methods that accept an asset path string use your namespace by default and also accept owner:path for a specific registered namespace. Paths use forward slashes, preserve case, and cannot traverse parent directories.

MemberBehaviour
ModAssets.LoadModelAsync(path, cancellationToken)Decodes a .glb or self-contained .gltf and returns a disposable ModelLease. Concurrent requests can share an import.
ModelLease.AssetExposes ModelAsset.Roots, Diagnostics, and GetNode(name). The node must be uniquely named.
ModAssets.InstantiateModel(lease, parent)Creates an owned UnityModelInstance under a Unity transform. Call and dispose on the game thread.
ModAssets.InvalidateModel(path)Evicts an owned cached model for future requests. Existing leases stay valid.

A model must include a renderable default scene and embed buffers and textures. Use static meshes. Required glTF extensions, skinned meshes, and morph targets are unsupported. Animations use the authored static pose. Use PNG or JPEG for icons.

StellarWorks documentation · Mods for StellarDrive