# Unity チュートリアル

このフォルダには、Diarkis Unity SDK をステップバイステップで学ぶための自己完結型チュートリアルが収録されています。各チュートリアルは前の内容を前提として構成されています。

| チュートリアル                             | テーマ                                |
| ----------------------------------- | ---------------------------------- |
| Tutorial 1 - Minimal Setup          | Diarkis サーバーへの接続 — HTTP 認証と UDP 接続 |
| Tutorial 2 - Ticket MatchMaker      | チケット方式マッチメイキング                     |
| Tutorial 3 - Host/Search MatchMaker | ホスト/サーチ方式マッチメイキング                  |
| Tutorial 4 - Room                   | ルーム参加・メンバー管理・ブロードキャスト              |
| Tutorial 5 - Direct Message         | UID を指定した特定クライアントへのメッセージ送信         |
| Tutorial 6 - Group                  | 文字列 ID で識別される軽量な pub/sub チャンネル     |

### 前提条件

* Unity 6000.0.64f1 以降
* Diarkis Unity SDK がプロジェクトにインポート済み
* 稼働中の Diarkis サーバー（ホストアドレスとクライアントキー）

### はじめ方

各チュートリアルには `Tutorials/Scenes/` 以下に専用シーン、`Tutorials/Scripts/` 以下に対応するマネージャースクリプトがあります。シーンを開き、チュートリアルの Markdown を読みながら Play モードに入ってください。

各チュートリアルスクリプトの先頭に、実行前に設定が必要な定数があります。

```csharp
private const string HOST       = "127.0.0.1:7000"; // サーバーアドレス
private const string CLIENT_KEY = "";               // クライアントキー
private const string UID        = "";               // 空文字の場合はランダム生成
```

### チュートリアルスクリプトは自由に改変できます

`Tutorials/Scripts/` 内のスクリプトは、ドキュメントと並行して読むことを想定した、意図的にシンプルな実装です。**自由に編集・実験してください**。また、独自機能を実装する際の出発点としても活用できます。

オリジナルを残しつつ実験したい場合は、変更前にスクリプトとシーンを複製してください。


---

# Agent Instructions: 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://help.diarkis.io/diarkis-client/chtoriaru/unity-chtoriaru.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.
