Class BuildEvents
Provides events for the building system, allowing mods to customize items as they're placed. Subscribe to these events instead of using Harmony patches on BuildManager.
public static class BuildEvents
- Inheritance
-
BuildEvents
- Inherited Members
Examples
// Customize materials when items are placed
BuildEvents.OnGridItemCreated += (args) =>
{
if (args.ItemId == "my_custom_rack")
{
MaterialHelper.ReplaceMaterials(args.GameObject, ...);
}
};
Events
OnBuildableItemInitialized
Event raised after a buildable item component is initialized. This event fires for all buildable items and can be used for additional setup.
public static event Action<BuildEventArgs> OnBuildableItemInitialized
Event Type
OnGridItemCreated
Event raised after a grid item (wall-mounted or floor-placed) is created in the world. This is the most common build event for furniture and storage items.
public static event Action<BuildEventArgs> OnGridItemCreated
Event Type
Remarks
Subscribers receive a BuildEventArgs containing the item and GameObject. The GameObject can be modified to change appearance or behavior.
OnSurfaceItemCreated
Event raised after a surface item (table-top item) is created.
public static event Action<BuildEventArgs> OnSurfaceItemCreated