Models and materials
Embed OBJ models and PNG/JPEG textures in your mod's DLL.
Embed assets
Add Assets/cube.obj and Assets/panel.png to your project. You can use the Showcase assets to try this example.
Add to your .csproj:
<ItemGroup>
<EmbeddedResource Include="Assets/cube.obj" LogicalName="MyFirstMod.cube.obj" />
<EmbeddedResource Include="Assets/panel.png" LogicalName="MyFirstMod.panel.png" />
</ItemGroup>Include is the disk path; LogicalName is the exact resource name used in code.
Use a mesh on an inventory item
Add using StellarStriderLib.Models; and using UnityEngine;. Register after creating content:
content.RegisterItem(new ItemDefinition
{
Id = "model_chip",
Name = "Model Chip",
Mass = 0.1f,
Models = new[]
{
new MeshDefinition
{
Resource = "MyFirstMod.cube.obj",
Scale = new Vector3(0.15f, 0.03f, 0.1f),
Material = new MaterialDefinition
{
Kind = MaterialKind.Solid,
Tint = Color.cyan,
TextureResource = "MyFirstMod.panel.png"
}
}
}
});Meshes use local Position, Euler Rotation, and Scale. Visual scale does not resize collision boxes.
Choose a material
| Kind | Use |
|---|---|
Native | Keep a cloned native material |
Solid | Apply a tint/texture without the native atlas |
Unlit | Draw without lighting |
The defaults are Solid, native material LogicGates, and white tint.
Preserve a donor's UI
Setting a part's Models replaces its visual hierarchy. For interactive donors such as Constant, leave Models=null and use Configure to replace only decorative renderers. Keep the native UI, writable visual components, and sockets.
Showcase's ConfigureConsole demonstrates this with Assets.AddMesh.
Configure and load assets
ConfigureMesh runs after each declared mesh is added. Final Configure runs after sockets and shapes. Do not change assigned numeric IDs.
Use content.Assets.Texture("MyFirstMod.panel.png") for a category icon. Cached assets belong to SSLib; do not destroy them or mutate shared copies.
See Asset APIs for resource archives, OBJ conventions, helper methods, and ownership rules.