> For the complete documentation index, see [llms.txt](https://docs.gamechat.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gamechat.me/basics/game-chat-v3/game-chat-ri-ben-yu/v3nowo/chu-qi-hua.md).

# 初期化

## 初期化 <a href="#undefined" id="undefined"></a>

Game Chatを使用する前に初期化します。ダッシュボードから確認したプロジェクト IDを追加します。Game Chatを初期化する方法は、次の通りです。

1. ダッシュボードにアクセスし、設定メニューでプロジェクト IDを確認します。
2. インスタンスを初期化するには、以下のコードを使用します。

* NBaseSDKモジュールをインポートします。

```csharp
using NBaseSDK;
```

* NBaseSDK Chatインスタンスを作成します。

```csharp
NBaseSDK.Chat nc = NBaseSDK.Chat.GetInstance();
```

* プロジェクト IDとリージョン、言語コードで Ncloud Chatを初期化します。

```csharp
nc.initialize([PROJECT_ID], [REGION], [LANGUAGE]);
```

<table><thead><tr><th width="158">ID</th><th width="110">Type</th><th width="371">Description</th><th>Required</th></tr></thead><tbody><tr><td>PROJECT_ID</td><td>string</td><td>ID(Game Chatダッシュボードの Project ID)</td><td>O</td></tr><tr><td>REGION</td><td>string</td><td>リージョン(別途使用する場合以外は、「kr」で使用)</td><td>O</td></tr><tr><td>LANGUAGE</td><td>string</td><td>言語コード(「ja」、「ko」など)</td><td>O</td></tr></tbody></table>

## エラー処理 <a href="#undefined" id="undefined"></a>

* 基本的なエラー処理は以下のように try ...catch内にコードを追加します。

```csharp
try
{
    // ここに、エラーが発生し得るコードを作成します。
    ...
}
catch (InvalidOperationException e)
{
    // ここに、特定エラータイプの処理を作成します。
    Console.WriteLine("InvalidOperationException: {0}", e.Message);
}
catch(Exception e)
{
    // ここに、一般的なエラー処理を作成します。
    Console.WriteLine("Error: {0}", e.Message);
}
```


---

# 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://docs.gamechat.me/basics/game-chat-v3/game-chat-ri-ben-yu/v3nowo/chu-qi-hua.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.
