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
| Members | Behaviour |
|---|---|
WithName, WithDescription, WithLocalization | Set display text and optional name and description keys. |
WithModel, WithIcon | Select a required model and an optional inventory or build icon. |
WithSize, WithMass, WithResistance | Set 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, RequiresResearch | Set a build tab, add a solid item cost, or add a prerequisite. The default is the StellarWorks build tab. |
WithPlacement, WithCollider, WithSocket | Set the placement surface and geometry. |
WithJigsawPoint, WithJigsawNode, WithSocketRelay | Add placement endpoints and native connections. |
WithNativeStorage | Enables stock ten-slot chest storage. On authority it is available through PartContext.Inventory. |
AddComponent, WithMetadata | Attach registered behaviour and store structured definition metadata. |
Placement and geometry
| Type | Fields and constraints |
|---|---|
BoxColliderDefinition | Size, Center, optional Node. Use 1–64 explicit boxes. A named node must resolve uniquely in the model. |
PlacementSurface | Floor (default), Wall, Any, Jigsaw. A named mount must reference a declared structural socket. |
SocketDefinition | Unique local ID, SocketKind, position, optional slot and rotation. Structural sockets omit the slot. Cable sockets use distinct slots 0..n-1. |
SocketRelay | Two distinct power sockets or two distinct fluid sockets, each used in at most one relay. |
JigsawEndpointDefinition | Shared 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.
| Member | Behaviour |
|---|---|
ModAssets.LoadModelAsync(path, cancellationToken) | Decodes a .glb or self-contained .gltf and returns a disposable ModelLease. Concurrent requests can share an import. |
ModelLease.Asset | Exposes 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.