> For the complete documentation index, see [llms.txt](https://espergames.gitbook.io/inventool/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://espergames.gitbook.io/inventool/scripting/initialization.md). Agents can also search and read this documentation through its [MCP server](https://espergames.gitbook.io/inventool/~gitbook/mcp).

# Initialization

How to initialize Inventool.

## Initialize

For some parts of Inventool to function correctly, it's required to tell it which objects are the player transform and main camera. **This only needs to be called once before working with Inventool's API.**

```csharp
// playerTransform is the Transform of the player character
// mainCamera is the Camera that the player sees through
Inventool.Initialize(playerTransform, mainCamera);
```

### Updating Player Transform and Camera

If the player transform or main camera ever change, you can let Inventool know by setting the new values.

```csharp
// Set the new player transform
Inventool.playerTransform = newPlayerTransform

// Set the new main camera
Inventool.mainCamera = newMainCamera;
```

## Terminate

To have the opposite effect of initialize, use `Terminate`. This is useful when Inventool's functionality is no longer required, such as when exiting the game or navigating to the main menu. **`Initialize` will need to be called again before working with Inventool's API.** This will also clear most event callbacks for all parts Inventool, so ensure your events are being set once again when required.

```csharp
Inventool.Terminate();
```
