> For the complete documentation index, see [llms.txt](https://teogames.gitbook.io/dynamic-mesh-combiner/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://teogames.gitbook.io/dynamic-mesh-combiner/components/mc-extractor.md).

# MC Extractor

## Overview

The MC Extractor component allows you to extract and bake all `MC Combinable` instances from a provided object. It offers various features such as scaling the output mesh along the normal (useful for highlighting objects), rendering a specific percentage of meshes (e.g., for showing a construction process), and extracting meshes with overridden materials (e.g., transparent holograms or custom shaders). The component provides configuration options to customize its behavior.

## Features

The MC Extractor component provides the following features:

* **Scale Output Mesh Along Normal:** Enables scaling the output mesh along the normal direction, which can be useful for highlighting objects.
* **Render 0-100% of Meshes:** Allows rendering a specified percentage of the extracted meshes, facilitating dynamic visualization (e.g., showing a construction process step by step).
* **Extract Meshes with Overridden Material:** Supports extracting meshes with overridden materials, such as transparent holograms or meshes using custom shaders.
* **Show By Default:** When enabled, all extracted meshes are shown at the start.
* **Use Relative Scale:** When enabled, each mesh's individual scale is used to scale the mesh instead of a global scale. This can be useful when outlining objects with different scales.
* **Async Mode:** When enabled, the extraction process runs asynchronously, utilizing up to 10ms per frame. Async mode is recommended when speed is not a critical factor.
* **Global Material:** If set, the global material will override all materials of the extracted meshes.

## Public Methods

The MC Extractor component provides the following public methods for script usage:

### `void Clean()`

This method cleans up the extracted meshes, removing any previously extracted meshes from the scene.

### `void Show(int id)`

Shows the mesh with the specified `id`. The mesh becomes visible in the scene.

### `void ShowAll()`

Shows all extracted meshes, making them visible in the scene.

### `void Hide(int id)`

Hides the mesh with the specified `id`. The mesh becomes invisible in the scene.

### `void HideAll()`

Hides all extracted meshes, making them invisible in the scene.

### `bool IsValidCombinable(Combinable combinable)`

Checks if a given `Combinable` instance is a valid combinable mesh that can be extracted by the MC Extractor. Returns `true` if the combinable is valid; otherwise, returns `false`.

### `Task Build(Transform original)`

Starts the asynchronous process of building the extracted meshes based on the provided `original` transform. Returns a `Task` that can be awaited to track the completion of the build operation.

### `Task Build(Transform original, Vector3 offset, Vector3 rotation, float scale)`

An overloaded version of the `Build` method that allows you to specify additional offset, rotation, and scale parameters to modify the extracted meshes' placement and size. Returns a `Task` that can be awaited.

The MC Extractor component and its associated public methods offer control and flexibility for managing the extraction and visibility of meshes in your scripts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://teogames.gitbook.io/dynamic-mesh-combiner/components/mc-extractor.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
