> For the complete documentation index, see [llms.txt](https://cowsinss-organization.gitbook.io/save-and-load-add-on/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cowsinss-organization.gitbook.io/save-and-load-add-on/content/03.-content/03.8-type-registry/typeregistry.md).

# TypeRegistry

*The `TypeRegistry` class is part of the `cowsins.SaveLoad` namespace and provides functionality for mapping types to associated prefabs. This mapping allows for loading and instantiating objects from a saved state. When an object is loaded from a save file, only the object's type and its associated save fields are available. However, the actual object cannot be instantiated directly from this information alone. The `TypeRegistry` serves as a lookup table to associate types with prefabs. This way, once the object type is identified, the corresponding prefab can be instantiated, and additional data can be loaded afterward.*

*TypeRegistry is implemented by* [*GameDataManager*](/save-and-load-add-on/content/03.-content/03.1-datapersistence/gamedatamanager.md)*. For more information regarding TypeRegistry & how to associate Prefabs to Types, please navigate to* [*GameDataManager´s page*](/save-and-load-add-on/content/03.-content/03.1-datapersistence/gamedatamanager.md#type-to-prefab-mappings)*.*

{% hint style="danger" %}
To optimize performance and minimize overhead, include only necessary types in the Type-to-Prefab mapping. Avoid references that are unnecessary or unused.
{% endhint %}


---

# 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:

```
GET https://cowsinss-organization.gitbook.io/save-and-load-add-on/content/03.-content/03.8-type-registry/typeregistry.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
