Couple Roulette
Un brise-glace de soirée pour VRChat : les joueurs rejoignent ou quittent un pool à tout moment, et seul l'owner de l'instance ou le master peut lancer un tirage, qui retire automatiquement les deux joueurs tirés. Toute la logique réseau passe par un pattern owner-authoritative standard, compatible avec les anciennes versions d'UdonSharp.
Fonctionnalités
Le système repose sur sept briques principales, chacune avec une portée réseau différente.
Join / Leave accessibles à tous, à tout moment, sans restriction.
Vérifié côté propriétaire réseau via isMaster || isInstanceOwner — impossible à contourner.
Les deux joueurs tirés sont retirés du pool. Un joueur qui quitte l'instance est aussi nettoyé automatiquement.
Réservé à l'owner/host par défaut, via le bool inspecteur restrictResetToOwnerOrHost.
BehaviourSyncMode.Manual pour synchroniser les tableaux de participants.
VRC_UIShape, Box Collider, Event Camera et Input Module générés automatiquement.
Logo et nom de groupe modifiables dans l'Inspector — purement visuel, aucune logique réseau.
Ce qui est synchronisé, et ce qui reste local
Les données de jeu sont répliquées réseau ; l'état visuel des boutons est purement local à chaque client.
| Donnée | Contenu | Réseau | Notes |
|---|---|---|---|
| participantIds / Names | Liste des joueurs dans la roulette | Synchronisé | int[] / string[] |
| participantCount | Nombre de participants actuels | Synchronisé | — |
| lastCoupleA / BName | Dernier couple tiré | Synchronisé | Effacé au Reset |
| hasDrawnResult / notEnoughPlayers | État d'affichage du résultat | Synchronisé | — |
| drawButton / resetButton.interactable | Grisage visuel des boutons | Local uniquement | Recalculé à chaque RefreshUI() |
Règles implémentées
| Règle | Implémentation |
|---|---|
| Join/Leave à tout moment | Accessible à tous, aucune restriction |
| Seul owner/host peut tirer | Vérifié côté propriétaire réseau via isMaster || isInstanceOwner |
| Tirage = 2 noms distincts | Deux index distincts tirés uniformément |
| Retrait après tirage | Les deux participants tirés sont retirés de la liste |
| < 2 joueurs → tirage bloqué | Message "pas assez de joueurs", aucune mutation d'état |
| Reset configurable | restrictResetToOwnerOrHost (bool inspecteur, activé par défaut) |
Mise en place
Le package inclut un Prefab prêt à l'emploi — c'est la méthode recommandée, aucune génération à faire.
- Importe le package Unity (
.unitypackage) dans ton projet. - Glisse
CoupleRoulette.prefabdepuis le Project window dans ta Hierarchy. - Positionne-le où tu veux dans ton monde — il est déjà entièrement cliquable et configuré.
- Teste en ClientSim (Play Mode), puis en Build & Test avec 2 comptes pour valider le réseau.
Utile si tu pars de zéro ou si tu veux repartir d'un état vierge après une personnalisation profonde.
CoupleRouletteManager.csvia clic-droit > Create > U# Script (pas "C# Script"),CoupleRouletteUIBuilder.csdansAssets/Editor/.- Menu
Tools > Random Couple Roulette > Build UI in Scene. - Voir la section Documentation complète pour le détail de cette méthode.
Modifier l'UI
Deux façons de personnaliser les couleurs, textes ou tailles du panneau, selon que tu veux un ajustement ponctuel ou un changement qui se régénère automatiquement.
- Dans la Hierarchy, déplie
CoupleRouletteCanvas > Backgroundpour voir tous les éléments (panneaux, textes, boutons). - Sélectionne l'élément à modifier — par exemple
JoinButton. - Pour changer une couleur : composant
Image > Color.- Pour changer un texte ou son style : composant
TextMeshPro - Text (UI) > Text Input, ouFont Size/Vertex Color.
- Pour changer un texte ou son style : composant
- Les changements sont immédiats et persistent dans la scène — sauvegarde la scène (Ctrl+S) une fois satisfait.
En Play Mode / ClientSim, les modifications faites sur les objets ne sont pas sauvegardées — modifie toujours en dehors du Play Mode.
- Ouvrir
CoupleRouletteUIBuilder.cs. - Repérer les valeurs à ajuster : couleurs (
new Color(...)), tailles de panneaux (new Vector2(...)), textes des boutons, positions. - Supprimer
CoupleRouletteCanvasetCoupleRouletteManagerexistants dans la Hierarchy. - Relancer
Tools > Random Couple Roulette > Build UI in Scenepour régénérer l'UI avec les nouvelles valeurs.
Pratique si tu veux un style cohérent sur plusieurs mondes : modifie le script une seule fois, puis régénère l'UI à chaque nouveau projet sans tout refaire à la main.
Les couleurs par défaut du script sont un thème bleu glacé.
| Élément | Couleur | Hex | Où dans le script |
|---|---|---|---|
| Fond (Background) | Bleu nuit quasi-noir | #050912 | CreatePanel("Background", ...) |
| Panneaux / bandeau | Bleu nuit | #0E1B32 | CreatePanel("ParticipantsPanel"/"DrawResultPanel"/"GroupHeader", ...) |
| Titre "PARTICIPANTS" | Bleu glacé pâle | #9AB6D2 | CreateText("Title", "PARTICIPANTS", ...) |
| Titre "DRAW RESULT" | Cyan lumineux | #91E3FD | CreateText("Title", "DRAW RESULT", ...) |
| Texte du corps | Blanc glacé | #D6E2EE | CreateText("ListText"/"ResultText", ...) |
| Bouton Join | Bleu périwinkle | #7EA8D2 | CreateButton("JoinButton", ...) |
| Bouton Leave | Indigo profond | #4956A2 | CreateButton("LeaveButton", ...) |
| Bouton Draw | Terracotta (accent chaud) | #C78F7D | CreateButton("DrawButton", ...) |
| Bouton Reset | Blanc glacé, texte foncé | #DAE6F2 / #0D1424 | CreateButton("ResetButton", ..., textColor) |
Le Canvas contient un bandeau en haut avec deux éléments purement visuels (aucune logique réseau).
GroupLogo(sousCoupleRouletteCanvas > Background > GroupHeader) : uneImagevide par défaut. Importe ton PNG dans Unity, règle son Texture Type surSprite (2D and UI), puis glisse-le dans le champ Source Image.GroupNameText(même parent) : unTextMeshPro - Text (UI)avec le texte par défaut "NOM DE TON GROUPE" — remplace-le par le nom de ton groupe ou de ton instance.
Dépannage
Les trois blocages les plus fréquents rencontrés en configurant ce système.
| Symptôme | Cause | Solution |
|---|---|---|
| Boutons non cliquables | Canvas sans VRC_UIShape / Box Collider / Event Camera | Généré automatiquement par le UI Builder |
| "StandaloneInputModule will not work" | Active Input Handling réglé sur le nouveau Input System | Remplacer par InputSystemUIInputModule sur l'EventSystem |
| "Unable to find valid U# program asset" | Script créé par copie de fichier plutôt que via le menu Unity | Supprimer le script, le recréer via Create > U# Script, y recoller le code |
Avec l'installation via Prefab (recommandée), tu ne rencontres jamais ce dernier problème : le Program Asset est déjà inclus et lié dans le package. Ce tableau reste utile uniquement si tu régénères l'UI depuis le script.
Documentation complète
Le contenu du package et du README, pour référence complète.
Le .unitypackage contient les scripts, un CoupleRoulette.prefab prêt à l'emploi (Program Asset déjà lié), les README en 3 langues, et un fichier "How to use.txt" pointant vers cette documentation.
- Crée un
GameObject > UI > Canvas, mets son Render Mode surWorld Space, donne-lui une taille raisonnable (Rect Transform 1000×590, Scale 0.002 → environ 2m de large). - Vérifie qu'un
EventSystemexiste dans la scène. - Sous le Canvas, crée :
- Un panneau Participants avec un
TextMeshPro - Text (UI)pour la liste - Un panneau Draw Result avec un
TextMeshPro - Text (UI)pour le résultat - 4 boutons : Join Roulette, Leave Roulette, Draw a Couple (2 players), Reset Roulette
- Un panneau Participants avec un
- Crée un GameObject vide
CoupleRouletteManager, ajoute-lui le script (viaCreate > U# Script). - Dans l'inspecteur, glisse le texte de la liste → Participants List Text, le texte du résultat → Draw Result Text, les boutons Draw/Reset (optionnel).
- Pour chaque bouton, dans son
Button > OnClick(): glisse le GameObject CoupleRouletteManager, choisisSendCustomEvent (Dynamic string), tape le nom d'événement (Join,Leave,DrawCouple,ResetRoulette). - Ajoute VRC_UIShape + Box Collider sur le Canvas, et assigne une Event Camera (voir Dépannage).
| Owner ou host | Créateur de l'instance (isInstanceOwner) OU master actuel (isMaster) |
| Reset | Restreint à l'owner/host par défaut (option désactivable), puisqu'il efface l'état pour tout le monde |
| Capacité | 32 participants max (MAX_PARTICIPANTS dans le script, modifiable) |
| Noms affichés | Capturés au moment du Join, non mis à jour si un joueur change de nom en cours de session |
- Le séparateur entre les deux noms tirés est actuellement "&" (pour éviter les soucis de police avec certains émojis) — remplaçable par un cœur si ta police TMP le supporte.
- Un panneau "Rules" affichant les règles dans le monde n'est pas inclus par défaut.
- Couleurs et bandeau logo : voir la section Modifier l'UI ci-dessus.
Le vrai test de concurrence (deux joueurs qui cliquent "Join" en même temps) ne se voit qu'en réseau réel : utilise Build & Test avec deux comptes VRChat, ou demande à un ami de tester avec toi en instance privée.
Couple Roulette
A party icebreaker for VRChat: players join or leave a pool at any time, and only the instance owner or master can trigger a draw, which automatically removes the two drawn players. All networking logic runs on a standard owner-authoritative pattern, compatible with older UdonSharp versions.
Features
The system rests on seven main building blocks, each with a different network scope.
Join / Leave available to everyone, at any time, with no restriction.
Checked on the network owner's side via isMaster || isInstanceOwner — cannot be bypassed.
The two drawn players are removed from the pool. A player who leaves the instance is also cleaned up automatically.
Restricted to owner/host by default, via the inspector bool restrictResetToOwnerOrHost.
BehaviourSyncMode.Manual to sync the participant arrays.
VRC_UIShape, Box Collider, Event Camera and Input Module generated automatically.
Logo and group name editable in the Inspector — purely visual, no network logic.
What's synced, and what stays local
Game data is replicated over the network; the buttons' visual state is purely local to each client.
| Data | Content | Network | Notes |
|---|---|---|---|
| participantIds / Names | List of players in the roulette | Synced | int[] / string[] |
| participantCount | Current number of participants | Synced | — |
| lastCoupleA / BName | Last drawn couple | Synced | Cleared on Reset |
| hasDrawnResult / notEnoughPlayers | Result display state | Synced | — |
| drawButton / resetButton.interactable | Visual greying of buttons | Local only | Recomputed on every RefreshUI() |
Rules implemented
| Rule | Implementation |
|---|---|
| Join/Leave at any time | Available to everyone, no restriction |
| Only owner/host can draw | Checked on the network owner's side via isMaster || isInstanceOwner |
| Draw = 2 distinct names | Two distinct indices drawn uniformly |
| Removal after draw | Both drawn participants are removed from the list |
| < 2 players → draw blocked | "Not enough players" message, no state mutation |
| Configurable reset | restrictResetToOwnerOrHost (inspector bool, on by default) |
Setup
The package includes a ready-to-use Prefab — this is the recommended method, nothing to generate.
- Import the Unity package (
.unitypackage) into your project. - Drag
CoupleRoulette.prefabfrom the Project window into your Hierarchy. - Position it anywhere in your world — it's already fully clickable and configured.
- Test in ClientSim (Play Mode), then in Build & Test with 2 accounts to validate the network.
Useful if you're starting from scratch or want a clean slate after deep customization.
CoupleRouletteManager.csvia right-click > Create > U# Script (not "C# Script"),CoupleRouletteUIBuilder.csinAssets/Editor/.- Menu
Tools > Random Couple Roulette > Build UI in Scene. - See the Full documentation section for the detailed method.
Modifying the UI
Two ways to customize the panel's colors, text or sizes, depending on whether you want a one-off tweak or a change that regenerates automatically.
- In the Hierarchy, expand
CoupleRouletteCanvas > Backgroundto see every element (panels, text, buttons). - Select the element to change — for example
JoinButton. - To change a color:
Image > Colorcomponent.- To change text or its style:
TextMeshPro - Text (UI) > Text Inputcomponent, orFont Size/Vertex Color.
- To change text or its style:
- Changes are immediate and persist in the scene — save the scene (Ctrl+S) once you're happy with it.
In Play Mode / ClientSim, changes made to objects are not saved — always edit outside Play Mode.
- Open
CoupleRouletteUIBuilder.cs. - Find the values to adjust: colors (
new Color(...)), panel sizes (new Vector2(...)), button text, positions. - Delete the existing
CoupleRouletteCanvasandCoupleRouletteManagerin the Hierarchy. - Re-run
Tools > Random Couple Roulette > Build UI in Sceneto regenerate the UI with the new values.
Handy if you want a consistent style across multiple worlds: edit the script once, then regenerate the UI for every new project without redoing it all by hand.
The script's default colors are an ice-blue theme.
| Element | Color | Hex | Where in the script |
|---|---|---|---|
| Background | Near-black night blue | #050912 | CreatePanel("Background", ...) |
| Panels / header band | Night blue | #0E1B32 | CreatePanel("ParticipantsPanel"/"DrawResultPanel"/"GroupHeader", ...) |
| "PARTICIPANTS" title | Pale ice blue | #9AB6D2 | CreateText("Title", "PARTICIPANTS", ...) |
| "DRAW RESULT" title | Bright cyan | #91E3FD | CreateText("Title", "DRAW RESULT", ...) |
| Body text | Ice white | #D6E2EE | CreateText("ListText"/"ResultText", ...) |
| Join button | Periwinkle blue | #7EA8D2 | CreateButton("JoinButton", ...) |
| Leave button | Deep indigo | #4956A2 | CreateButton("LeaveButton", ...) |
| Draw button | Terracotta (warm accent) | #C78F7D | CreateButton("DrawButton", ...) |
| Reset button | Ice white, dark text | #DAE6F2 / #0D1424 | CreateButton("ResetButton", ..., textColor) |
The Canvas includes a banner at the top with two purely visual elements (no network logic).
GroupLogo(underCoupleRouletteCanvas > Background > GroupHeader): an emptyImageby default. Import your PNG into Unity, set its Texture Type toSprite (2D and UI), then drag it into the Source Image field.GroupNameText(same parent): aTextMeshPro - Text (UI)with the default text "NOM DE TON GROUPE" — replace it with your group or instance name.
Troubleshooting
The three most common blockers encountered while setting up this system.
| Symptom | Cause | Fix |
|---|---|---|
| Buttons not clickable | Canvas missing VRC_UIShape / Box Collider / Event Camera | Generated automatically by the UI Builder |
| "StandaloneInputModule will not work" | Active Input Handling set to the new Input System | Replace with InputSystemUIInputModule on the EventSystem |
| "Unable to find valid U# program asset" | Script created by copying a file rather than via the Unity menu | Delete the script, recreate it via Create > U# Script, paste the code back in |
With the Prefab installation (recommended), you never run into this last issue: the Program Asset is already included and linked in the package. This table only stays useful if you regenerate the UI from the script.
Full documentation
The package and README content, for full reference.
The .unitypackage contains the scripts, a ready-to-use CoupleRoulette.prefab (Program Asset already linked), READMEs in 3 languages, and a "How to use.txt" file pointing to this documentation.
- Create a
GameObject > UI > Canvas, set its Render Mode toWorld Space, give it a reasonable size (Rect Transform 1000×590, Scale 0.002 → about 2m wide). - Check that an
EventSystemexists in the scene. - Under the Canvas, create:
- A Participants panel with a
TextMeshPro - Text (UI)for the list - A Draw Result panel with a
TextMeshPro - Text (UI)for the result - 4 buttons: Join Roulette, Leave Roulette, Draw a Couple (2 players), Reset Roulette
- A Participants panel with a
- Create an empty GameObject
CoupleRouletteManager, add the script to it (viaCreate > U# Script). - In the inspector, drag the list text → Participants List Text, the result text → Draw Result Text, the Draw/Reset buttons (optional).
- For each button, under its
Button > OnClick(): drag the CoupleRouletteManager GameObject, chooseSendCustomEvent (Dynamic string), type the event name (Join,Leave,DrawCouple,ResetRoulette). - Add VRC_UIShape + Box Collider on the Canvas, and assign an Event Camera (see Troubleshooting).
| Owner or host | Instance creator (isInstanceOwner) OR current master (isMaster) |
| Reset | Restricted to owner/host by default (toggleable), since it clears state for everyone |
| Capacity | 32 participants max (MAX_PARTICIPANTS in the script, adjustable) |
| Displayed names | Captured at Join time, not updated if a player renames mid-session |
- The separator between the two drawn names is currently "&" (to avoid font issues with some emoji) — swap in a heart if your TMP font supports it.
- A "Rules" panel showing the rules in-world is not included by default.
- Colors and logo banner: see the Modifying the UI section above.
The real concurrency test (two players clicking "Join" at the same time) only shows up on a real network: use Build & Test with two VRChat accounts, or have a friend test with you in a private instance.
Couple Roulette
VRChat向けのパーティー用アイスブレイカー。プレイヤーはいつでもプールに参加・離脱でき、インスタンスのオーナーまたはマスターだけが抽選を実行できます。抽選された2人は自動的にプールから外れます。ネットワーク処理はすべて標準的なowner-authoritativeパターンで行われ、古いバージョンのUdonSharpにも対応しています。
機能
このシステムは7つの主要な要素で構成されており、それぞれネットワーク上の扱いが異なります。
Join / Leaveは誰でも、いつでも、制限なく行えます。
ネットワークの所有者側でisMaster || isInstanceOwnerにより検証され、回避できません。
抽選された2人はプールから外れます。インスタンスを離れたプレイヤーも自動的に整理されます。
インスペクタのbool restrictResetToOwnerOrHostにより、既定でowner/hostに限定されます。
参加者の配列を同期するためにBehaviourSyncMode.Manualを使用。
VRC_UIShape、Box Collider、Event Camera、Input Moduleが自動的に生成されます。
Inspectorでロゴとグループ名を編集可能 — 純粋に視覚的な要素で、ネットワークロジックなし。
同期される内容と、ローカルのみの内容
ゲームデータはネットワーク上で複製されます。ボタンの見た目の状態は各クライアントのローカルのみです。
| データ | 内容 | ネットワーク | 備考 |
|---|---|---|---|
| participantIds / Names | ルーレット参加者の一覧 | 同期 | int[] / string[] |
| participantCount | 現在の参加者数 | 同期 | — |
| lastCoupleA / BName | 最後に抽選されたカップル | 同期 | リセット時に消去 |
| hasDrawnResult / notEnoughPlayers | 結果表示の状態 | 同期 | — |
| drawButton / resetButton.interactable | ボタンのグレーアウト表示 | ローカルのみ | RefreshUI()のたびに再計算 |
実装されているルール
| ルール | 実装 |
|---|---|
| いつでもJoin/Leave可能 | 誰でもアクセス可能、制限なし |
| owner/hostのみ抽選可能 | ネットワークの所有者側でisMaster || isInstanceOwnerにより検証 |
| 抽選 = 異なる2名 | 均等に2つの異なるインデックスを抽選 |
| 抽選後の削除 | 抽選された2人がリストから削除される |
| 2人未満 → 抽選不可 | 「参加者が足りません」メッセージ、状態は変更なし |
| 設定可能なリセット | restrictResetToOwnerOrHost(インスペクタのbool、既定で有効) |
導入手順
パッケージにはすぐ使えるPrefabが同梱されています — こちらが推奨方法で、生成作業は不要です。
- Unityパッケージ(
.unitypackage)をプロジェクトにインポート。 - Project windowから
CoupleRoulette.prefabをHierarchyにドラッグ。 - ワールド内の好きな場所に配置 — 最初から完全にクリック可能で設定済みです。
- ClientSim(Play Mode)でテストしたのち、Build & Testで2アカウントを使いネットワークを検証。
ゼロから始めたい場合や、大きくカスタマイズした後にまっさらな状態に戻したい場合に便利です。
CoupleRouletteManager.csは右クリック > Create > U# Script から作成(「C# Script」ではなく)、CoupleRouletteUIBuilder.csはAssets/Editor/に配置。- メニュー
Tools > Random Couple Roulette > Build UI in Sceneを実行。 - 詳しい手順は「完全なドキュメント」セクションを参照。
UIを変更する
パネルの色・テキスト・サイズをカスタマイズする方法は2通りあります。一時的な調整か、自動的に再生成される変更かによって使い分けます。
- Hierarchyで
CoupleRouletteCanvas > Backgroundを展開し、すべての要素(パネル、テキスト、ボタン)を表示。 - 変更したい要素を選択 — 例:
JoinButton。 - 色を変更するには:
Image > Colorコンポーネント。- テキストやスタイルを変更するには:
TextMeshPro - Text (UI) > Text Inputコンポーネント、またはFont Size/Vertex Color。
- テキストやスタイルを変更するには:
- 変更は即座に反映されシーンに保持されます — 満足したらシーンを保存(Ctrl+S)。
Play Mode / ClientSim中の変更は保存されません — 必ずPlay Mode以外で編集してください。
CoupleRouletteUIBuilder.csを開く。- 調整したい値を探す:色(
new Color(...))、パネルサイズ(new Vector2(...))、ボタンのテキスト、位置。 - Hierarchy内の既存の
CoupleRouletteCanvasとCoupleRouletteManagerを削除。 Tools > Random Couple Roulette > Build UI in Sceneを再実行し、新しい値でUIを再生成。
複数のワールドで統一したスタイルにしたい場合に便利です:スクリプトを一度変更すれば、新しいプロジェクトごとに手作業をやり直さずにUIを再生成できます。
スクリプトのデフォルトカラーは、氷のようなブルーのテーマです。
| 要素 | 色 | Hex | スクリプト内の場所 |
|---|---|---|---|
| 背景(Background) | ほぼ黒に近い夜の青 | #050912 | CreatePanel("Background", ...) |
| パネル・バナー | 夜の青 | #0E1B32 | CreatePanel("ParticipantsPanel"/"DrawResultPanel"/"GroupHeader", ...) |
| 「PARTICIPANTS」タイトル | 薄い氷色の青 | #9AB6D2 | CreateText("Title", "PARTICIPANTS", ...) |
| 「DRAW RESULT」タイトル | 明るいシアン | #91E3FD | CreateText("Title", "DRAW RESULT", ...) |
| 本文テキスト | 氷のような白 | #D6E2EE | CreateText("ListText"/"ResultText", ...) |
| Joinボタン | ペリウィンクルブルー | #7EA8D2 | CreateButton("JoinButton", ...) |
| Leaveボタン | ディープインディゴ | #4956A2 | CreateButton("LeaveButton", ...) |
| Drawボタン | テラコッタ(暖色アクセント) | #C78F7D | CreateButton("DrawButton", ...) |
| Resetボタン | 氷のような白、濃い文字色 | #DAE6F2 / #0D1424 | CreateButton("ResetButton", ..., textColor) |
Canvasの上部には、純粋に視覚的な要素(ネットワークロジックなし)が2つ含まれるバナーがあります。
GroupLogo(CoupleRouletteCanvas > Background > GroupHeaderの下):既定では空のImageです。PNGをUnityにインポートし、Texture TypeをSprite (2D and UI)に設定して、Source Imageフィールドにドラッグしてください。GroupNameText(同じ親):既定のテキストが「NOM DE TON GROUPE」のTextMeshPro - Text (UI)です — あなたのグループ名やインスタンス名に置き換えてください。
トラブルシューティング
このシステムを設定する際によく遭遇する3つの問題。
| 症状 | 原因 | 解決策 |
|---|---|---|
| ボタンがクリックできない | CanvasにVRC_UIShape / Box Collider / Event Cameraがない | UI Builderが自動的に生成 |
| 「StandaloneInputModule will not work」 | Active Input Handlingが新しいInput Systemに設定されている | EventSystem上でInputSystemUIInputModuleに置き換える |
| 「Unable to find valid U# program asset」 | UnityのメニューではなくファイルコピーでScriptが作成された | スクリプトを削除し、Create > U# Scriptで再作成、コードを貼り直す |
Prefabでの導入(推奨)なら、この最後の問題には決して遭遇しません — Program Assetはパッケージに同梱・リンク済みです。この表はスクリプトからUIを再生成する場合にのみ役立ちます。
完全なドキュメント
パッケージとREADMEの内容を、参考として掲載します。
.unitypackageには、スクリプト、すぐ使えるCoupleRoulette.prefab(Program Asset同梱・リンク済み)、3言語のREADME、そしてこのドキュメントへのリンクを記載した「How to use.txt」が含まれています。
GameObject > UI > Canvasを作成し、Render ModeをWorld Spaceに設定、適切なサイズにする(Rect Transform 1000×590、Scale 0.002 → 約2m幅)。- シーンに
EventSystemが存在することを確認。 - Canvasの下に以下を作成:
- リスト用の
TextMeshPro - Text (UI)を持つParticipantsパネル - 結果用の
TextMeshPro - Text (UI)を持つDraw Resultパネル - 4つのボタン:Join Roulette、Leave Roulette、Draw a Couple (2 players)、Reset Roulette
- リスト用の
- 空のGameObject
CoupleRouletteManagerを作成し、スクリプトを追加(Create > U# Script経由)。 - インスペクタで、リストのテキスト → Participants List Text、結果のテキスト → Draw Result Text、Draw/Resetボタン(任意)をドラッグ。
- 各ボタンの
Button > OnClick()で:CoupleRouletteManagerのGameObjectをドラッグし、SendCustomEvent (Dynamic string)を選び、イベント名(Join、Leave、DrawCouple、ResetRoulette)を入力。 - Canvasに VRC_UIShape + Box Collider を追加し、Event Cameraを割り当てる(トラブルシューティング参照)。
| Owner または host | インスタンスの作成者(isInstanceOwner)または現在のmaster(isMaster) |
| リセット | 全員の状態を消去するため、既定でowner/hostに制限(切り替え可能) |
| 収容人数 | 最大32人(スクリプト内のMAX_PARTICIPANTS、変更可能) |
| 表示名 | Join時点で取得され、セッション中に改名しても更新されない |
- 抽選された2つの名前の区切り文字は現在「&」(一部の絵文字によるフォントの問題を避けるため)— TMPフォントが対応していればハートに置き換え可能。
- ワールド内でルールを表示する「Rules」パネルは既定では含まれません。
- 色とロゴバナー:上の「UIを変更する」セクションを参照してください。
本当の同時実行テスト(2人のプレイヤーが同時に「Join」をクリックする)は実際のネットワーク上でしか確認できません:2つのVRChatアカウントでBuild & Testを使うか、友人にプライベートインスタンスで一緒にテストしてもらってください。