Outil VRChat Éditeur

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.

✓ Fonctionnel
testé en ClientSim
UdonSharp VRChat SDK3 Sync réseau manuel Owner / Host uniquement UI auto-câblée
Panneau Couple Roulette en jeu
Panneau généré automatiquement — participants, résultat du tirage, et 4 boutons déjà câblés au réseau.

Fonctionnalités

Le système repose sur sept briques principales, chacune avec une portée réseau différente.

Pool ouvertLibre

Join / Leave accessibles à tous, à tout moment, sans restriction.

TirageOwner / Host

Vérifié côté propriétaire réseau via isMaster || isInstanceOwner — impossible à contourner.

NettoyageAuto

Les deux joueurs tirés sont retirés du pool. Un joueur qui quitte l'instance est aussi nettoyé automatiquement.

ResetConfigurable

Réservé à l'owner/host par défaut, via le bool inspecteur restrictResetToOwnerOrHost.

RéseauManual Sync

BehaviourSyncMode.Manual pour synchroniser les tableaux de participants.

UI BuilderAuto-généré

VRC_UIShape, Box Collider, Event Camera et Input Module générés automatiquement.

Bandeau logoPersonnalisable

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éeContenuRéseauNotes
participantIds / NamesListe des joueurs dans la rouletteSynchroniséint[] / string[]
participantCountNombre de participants actuelsSynchronisé—
lastCoupleA / BNameDernier couple tiréSynchroniséEffacé au Reset
hasDrawnResult / notEnoughPlayersÉtat d'affichage du résultatSynchronisé—
drawButton / resetButton.interactableGrisage visuel des boutonsLocal uniquementRecalculé à chaque RefreshUI()

Règles implémentées

RègleImplémentation
Join/Leave à tout momentAccessible à tous, aucune restriction
Seul owner/host peut tirerVérifié côté propriétaire réseau via isMaster || isInstanceOwner
Tirage = 2 noms distinctsDeux index distincts tirés uniformément
Retrait après tirageLes deux participants tirés sont retirés de la liste
< 2 joueurs → tirage bloquéMessage "pas assez de joueurs", aucune mutation d'état
Reset configurablerestrictResetToOwnerOrHost (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.

Installation (Prefab, recommandé)
  1. Importe le package Unity (.unitypackage) dans ton projet.
  2. Glisse CoupleRoulette.prefab depuis le Project window dans ta Hierarchy.
  3. Positionne-le où tu veux dans ton monde — il est déjà entièrement cliquable et configuré.
  4. Teste en ClientSim (Play Mode), puis en Build & Test avec 2 comptes pour valider le réseau.
Régénérer depuis le script (avancé)

Utile si tu pars de zéro ou si tu veux repartir d'un état vierge après une personnalisation profonde.

  1. CoupleRouletteManager.cs via clic-droit > Create > U# Script (pas "C# Script"), CoupleRouletteUIBuilder.cs dans Assets/Editor/.
  2. Menu Tools > Random Couple Roulette > Build UI in Scene.
  3. 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.

Modification rapide — dans l'Inspector
  1. Dans la Hierarchy, déplie CoupleRouletteCanvas > Background pour voir tous les éléments (panneaux, textes, boutons).
  2. Sélectionne l'élément à modifier — par exemple JoinButton.
  3. Pour changer une couleur : composant Image > Color.
    • Pour changer un texte ou son style : composant TextMeshPro - Text (UI) > Text Input, ou Font Size / Vertex Color.
  4. Les changements sont immédiats et persistent dans la scène — sauvegarde la scène (Ctrl+S) une fois satisfait.
Points de vigilance

En Play Mode / ClientSim, les modifications faites sur les objets ne sont pas sauvegardées — modifie toujours en dehors du Play Mode.

Modification permanente — dans le script
  1. Ouvrir CoupleRouletteUIBuilder.cs.
  2. Repérer les valeurs à ajuster : couleurs (new Color(...)), tailles de panneaux (new Vector2(...)), textes des boutons, positions.
  3. Supprimer CoupleRouletteCanvas et CoupleRouletteManager existants dans la Hierarchy.
  4. Relancer Tools > Random Couple Roulette > Build UI in Scene pour 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.

Palette actuelle

Les couleurs par défaut du script sont un thème bleu glacé.

Aperçu de la palette actuelle
Rendu approximatif des couleurs actuelles (pas une capture VRChat réelle — sert de référence visuelle rapide).
ÉlémentCouleurHexOù dans le script
Fond (Background)Bleu nuit quasi-noir#050912CreatePanel("Background", ...)
Panneaux / bandeauBleu nuit#0E1B32CreatePanel("ParticipantsPanel"/"DrawResultPanel"/"GroupHeader", ...)
Titre "PARTICIPANTS"Bleu glacé pâle#9AB6D2CreateText("Title", "PARTICIPANTS", ...)
Titre "DRAW RESULT"Cyan lumineux#91E3FDCreateText("Title", "DRAW RESULT", ...)
Texte du corpsBlanc glacé#D6E2EECreateText("ListText"/"ResultText", ...)
Bouton JoinBleu périwinkle#7EA8D2CreateButton("JoinButton", ...)
Bouton LeaveIndigo profond#4956A2CreateButton("LeaveButton", ...)
Bouton DrawTerracotta (accent chaud)#C78F7DCreateButton("DrawButton", ...)
Bouton ResetBlanc glacé, texte foncé#DAE6F2 / #0D1424CreateButton("ResetButton", ..., textColor)
Bandeau logo + nom de groupe

Le Canvas contient un bandeau en haut avec deux éléments purement visuels (aucune logique réseau).

  1. GroupLogo (sous CoupleRouletteCanvas > Background > GroupHeader) : une Image vide par défaut. Importe ton PNG dans Unity, règle son Texture Type sur Sprite (2D and UI), puis glisse-le dans le champ Source Image.
  2. GroupNameText (même parent) : un TextMeshPro - 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ômeCauseSolution
Boutons non cliquablesCanvas sans VRC_UIShape / Box Collider / Event CameraGénéré automatiquement par le UI Builder
"StandaloneInputModule will not work"Active Input Handling réglé sur le nouveau Input SystemRemplacer par InputSystemUIInputModule sur l'EventSystem
"Unable to find valid U# program asset"Script créé par copie de fichier plutôt que via le menu UnitySupprimer le script, le recréer via Create > U# Script, y recoller le code
Note

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.

Contenu du package

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.

Installation manuelle (sans script ni prefab)
  1. Crée un GameObject > UI > Canvas, mets son Render Mode sur World Space, donne-lui une taille raisonnable (Rect Transform 1000×590, Scale 0.002 → environ 2m de large).
  2. Vérifie qu'un EventSystem existe dans la scène.
  3. 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
  4. Crée un GameObject vide CoupleRouletteManager, ajoute-lui le script (via Create > U# Script).
  5. 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).
  6. Pour chaque bouton, dans son Button > OnClick() : glisse le GameObject CoupleRouletteManager, choisis SendCustomEvent (Dynamic string), tape le nom d'événement (Join, Leave, DrawCouple, ResetRoulette).
  7. Ajoute VRC_UIShape + Box Collider sur le Canvas, et assigne une Event Camera (voir Dépannage).
Choix de conception
Owner ou hostCréateur de l'instance (isInstanceOwner) OU master actuel (isMaster)
ResetRestreint à 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ésCapturés au moment du Join, non mis à jour si un joueur change de nom en cours de session
À savoir
  • 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.
Test recommandé

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.

VRChat Editor Tool

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.

✓ Working
tested in ClientSim
UdonSharp VRChat SDK3 Manual network sync Owner / Host only Auto-wired UI
Couple Roulette panel in-game
Auto-generated panel — participants, draw result, and 4 buttons already wired to the network.

Features

The system rests on seven main building blocks, each with a different network scope.

Open poolFree

Join / Leave available to everyone, at any time, with no restriction.

DrawOwner / Host

Checked on the network owner's side via isMaster || isInstanceOwner — cannot be bypassed.

CleanupAuto

The two drawn players are removed from the pool. A player who leaves the instance is also cleaned up automatically.

ResetConfigurable

Restricted to owner/host by default, via the inspector bool restrictResetToOwnerOrHost.

NetworkManual Sync

BehaviourSyncMode.Manual to sync the participant arrays.

UI BuilderAuto-generated

VRC_UIShape, Box Collider, Event Camera and Input Module generated automatically.

Logo bannerCustomizable

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.

DataContentNetworkNotes
participantIds / NamesList of players in the rouletteSyncedint[] / string[]
participantCountCurrent number of participantsSynced—
lastCoupleA / BNameLast drawn coupleSyncedCleared on Reset
hasDrawnResult / notEnoughPlayersResult display stateSynced—
drawButton / resetButton.interactableVisual greying of buttonsLocal onlyRecomputed on every RefreshUI()

Rules implemented

RuleImplementation
Join/Leave at any timeAvailable to everyone, no restriction
Only owner/host can drawChecked on the network owner's side via isMaster || isInstanceOwner
Draw = 2 distinct namesTwo distinct indices drawn uniformly
Removal after drawBoth drawn participants are removed from the list
< 2 players → draw blocked"Not enough players" message, no state mutation
Configurable resetrestrictResetToOwnerOrHost (inspector bool, on by default)

Setup

The package includes a ready-to-use Prefab — this is the recommended method, nothing to generate.

Installation (Prefab, recommended)
  1. Import the Unity package (.unitypackage) into your project.
  2. Drag CoupleRoulette.prefab from the Project window into your Hierarchy.
  3. Position it anywhere in your world — it's already fully clickable and configured.
  4. Test in ClientSim (Play Mode), then in Build & Test with 2 accounts to validate the network.
Regenerate from the script (advanced)

Useful if you're starting from scratch or want a clean slate after deep customization.

  1. CoupleRouletteManager.cs via right-click > Create > U# Script (not "C# Script"), CoupleRouletteUIBuilder.cs in Assets/Editor/.
  2. Menu Tools > Random Couple Roulette > Build UI in Scene.
  3. 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.

Quick edit — in the Inspector
  1. In the Hierarchy, expand CoupleRouletteCanvas > Background to see every element (panels, text, buttons).
  2. Select the element to change — for example JoinButton.
  3. To change a color: Image > Color component.
    • To change text or its style: TextMeshPro - Text (UI) > Text Input component, or Font Size / Vertex Color.
  4. Changes are immediate and persist in the scene — save the scene (Ctrl+S) once you're happy with it.
Heads up

In Play Mode / ClientSim, changes made to objects are not saved — always edit outside Play Mode.

Permanent edit — in the script
  1. Open CoupleRouletteUIBuilder.cs.
  2. Find the values to adjust: colors (new Color(...)), panel sizes (new Vector2(...)), button text, positions.
  3. Delete the existing CoupleRouletteCanvas and CoupleRouletteManager in the Hierarchy.
  4. Re-run Tools > Random Couple Roulette > Build UI in Scene to 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.

Current palette

The script's default colors are an ice-blue theme.

Current palette preview
Approximate render of the current colors (not an actual VRChat screenshot — a quick visual reference).
ElementColorHexWhere in the script
BackgroundNear-black night blue#050912CreatePanel("Background", ...)
Panels / header bandNight blue#0E1B32CreatePanel("ParticipantsPanel"/"DrawResultPanel"/"GroupHeader", ...)
"PARTICIPANTS" titlePale ice blue#9AB6D2CreateText("Title", "PARTICIPANTS", ...)
"DRAW RESULT" titleBright cyan#91E3FDCreateText("Title", "DRAW RESULT", ...)
Body textIce white#D6E2EECreateText("ListText"/"ResultText", ...)
Join buttonPeriwinkle blue#7EA8D2CreateButton("JoinButton", ...)
Leave buttonDeep indigo#4956A2CreateButton("LeaveButton", ...)
Draw buttonTerracotta (warm accent)#C78F7DCreateButton("DrawButton", ...)
Reset buttonIce white, dark text#DAE6F2 / #0D1424CreateButton("ResetButton", ..., textColor)
Logo + group name banner

The Canvas includes a banner at the top with two purely visual elements (no network logic).

  1. GroupLogo (under CoupleRouletteCanvas > Background > GroupHeader): an empty Image by default. Import your PNG into Unity, set its Texture Type to Sprite (2D and UI), then drag it into the Source Image field.
  2. GroupNameText (same parent): a TextMeshPro - 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.

SymptomCauseFix
Buttons not clickableCanvas missing VRC_UIShape / Box Collider / Event CameraGenerated automatically by the UI Builder
"StandaloneInputModule will not work"Active Input Handling set to the new Input SystemReplace with InputSystemUIInputModule on the EventSystem
"Unable to find valid U# program asset"Script created by copying a file rather than via the Unity menuDelete the script, recreate it via Create > U# Script, paste the code back in
Note

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.

Package contents

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.

Manual installation (no script, no prefab)
  1. Create a GameObject > UI > Canvas, set its Render Mode to World Space, give it a reasonable size (Rect Transform 1000×590, Scale 0.002 → about 2m wide).
  2. Check that an EventSystem exists in the scene.
  3. 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
  4. Create an empty GameObject CoupleRouletteManager, add the script to it (via Create > U# Script).
  5. In the inspector, drag the list text → Participants List Text, the result text → Draw Result Text, the Draw/Reset buttons (optional).
  6. For each button, under its Button > OnClick(): drag the CoupleRouletteManager GameObject, choose SendCustomEvent (Dynamic string), type the event name (Join, Leave, DrawCouple, ResetRoulette).
  7. Add VRC_UIShape + Box Collider on the Canvas, and assign an Event Camera (see Troubleshooting).
Design choices
Owner or hostInstance creator (isInstanceOwner) OR current master (isMaster)
ResetRestricted to owner/host by default (toggleable), since it clears state for everyone
Capacity32 participants max (MAX_PARTICIPANTS in the script, adjustable)
Displayed namesCaptured at Join time, not updated if a player renames mid-session
Good to know
  • 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.
Recommended testing

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.

VRChat エディタツール

Couple Roulette

VRChat向けのパーティー用アイスブレイカー。プレイヤーはいつでもプールに参加・離脱でき、インスタンスのオーナーまたはマスターだけが抽選を実行できます。抽選された2人は自動的にプールから外れます。ネットワーク処理はすべて標準的なowner-authoritativeパターンで行われ、古いバージョンのUdonSharpにも対応しています。

✓ 動作確認済み
ClientSimでテスト済み
UdonSharp VRChat SDK3 手動ネットワーク同期 Owner / Host限定 UI自動配線
ゲーム内のCouple Rouletteパネル
自動生成されたパネル — 参加者一覧、抽選結果、ネットワークに接続済みの4つのボタン。

機能

このシステムは7つの主要な要素で構成されており、それぞれネットワーク上の扱いが異なります。

参加プール自由

Join / Leaveは誰でも、いつでも、制限なく行えます。

抽選Owner / Host

ネットワークの所有者側でisMaster || isInstanceOwnerにより検証され、回避できません。

クリーンアップ自動

抽選された2人はプールから外れます。インスタンスを離れたプレイヤーも自動的に整理されます。

リセット設定可能

インスペクタのbool restrictResetToOwnerOrHostにより、既定でowner/hostに限定されます。

ネットワーク手動同期

参加者の配列を同期するためにBehaviourSyncMode.Manualを使用。

UI Builder自動生成

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が同梱されています — こちらが推奨方法で、生成作業は不要です。

導入(Prefab、推奨)
  1. Unityパッケージ(.unitypackage)をプロジェクトにインポート。
  2. Project windowからCoupleRoulette.prefabをHierarchyにドラッグ。
  3. ワールド内の好きな場所に配置 — 最初から完全にクリック可能で設定済みです。
  4. ClientSim(Play Mode)でテストしたのち、Build & Testで2アカウントを使いネットワークを検証。
スクリプトから再生成する(上級者向け)

ゼロから始めたい場合や、大きくカスタマイズした後にまっさらな状態に戻したい場合に便利です。

  1. CoupleRouletteManager.csは右クリック > Create > U# Script から作成(「C# Script」ではなく)、CoupleRouletteUIBuilder.csはAssets/Editor/に配置。
  2. メニューTools > Random Couple Roulette > Build UI in Sceneを実行。
  3. 詳しい手順は「完全なドキュメント」セクションを参照。

UIを変更する

パネルの色・テキスト・サイズをカスタマイズする方法は2通りあります。一時的な調整か、自動的に再生成される変更かによって使い分けます。

簡易な変更 — Inspectorで
  1. HierarchyでCoupleRouletteCanvas > Backgroundを展開し、すべての要素(パネル、テキスト、ボタン)を表示。
  2. 変更したい要素を選択 — 例:JoinButton。
  3. 色を変更するには:Image > Colorコンポーネント。
    • テキストやスタイルを変更するには:TextMeshPro - Text (UI) > Text Inputコンポーネント、またはFont Size / Vertex Color。
  4. 変更は即座に反映されシーンに保持されます — 満足したらシーンを保存(Ctrl+S)。
注意

Play Mode / ClientSim中の変更は保存されません — 必ずPlay Mode以外で編集してください。

恒久的な変更 — スクリプトで
  1. CoupleRouletteUIBuilder.csを開く。
  2. 調整したい値を探す:色(new Color(...))、パネルサイズ(new Vector2(...))、ボタンのテキスト、位置。
  3. Hierarchy内の既存のCoupleRouletteCanvasとCoupleRouletteManagerを削除。
  4. Tools > Random Couple Roulette > Build UI in Sceneを再実行し、新しい値でUIを再生成。

複数のワールドで統一したスタイルにしたい場合に便利です:スクリプトを一度変更すれば、新しいプロジェクトごとに手作業をやり直さずにUIを再生成できます。

現在のパレット

スクリプトのデフォルトカラーは、氷のようなブルーのテーマです。

現在のパレットのプレビュー
現在の色の簡易レンダリング(実際のVRChatのスクリーンショットではなく、素早く確認するための参考です)。
要素色Hexスクリプト内の場所
背景(Background)ほぼ黒に近い夜の青#050912CreatePanel("Background", ...)
パネル・バナー夜の青#0E1B32CreatePanel("ParticipantsPanel"/"DrawResultPanel"/"GroupHeader", ...)
「PARTICIPANTS」タイトル薄い氷色の青#9AB6D2CreateText("Title", "PARTICIPANTS", ...)
「DRAW RESULT」タイトル明るいシアン#91E3FDCreateText("Title", "DRAW RESULT", ...)
本文テキスト氷のような白#D6E2EECreateText("ListText"/"ResultText", ...)
Joinボタンペリウィンクルブルー#7EA8D2CreateButton("JoinButton", ...)
Leaveボタンディープインディゴ#4956A2CreateButton("LeaveButton", ...)
Drawボタンテラコッタ(暖色アクセント)#C78F7DCreateButton("DrawButton", ...)
Resetボタン氷のような白、濃い文字色#DAE6F2 / #0D1424CreateButton("ResetButton", ..., textColor)
ロゴ+グループ名バナー

Canvasの上部には、純粋に視覚的な要素(ネットワークロジックなし)が2つ含まれるバナーがあります。

  1. GroupLogo(CoupleRouletteCanvas > Background > GroupHeaderの下):既定では空のImageです。PNGをUnityにインポートし、Texture TypeをSprite (2D and UI)に設定して、Source Imageフィールドにドラッグしてください。
  2. 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」が含まれています。

手動セットアップ(スクリプト・prefabなし)
  1. GameObject > UI > Canvasを作成し、Render ModeをWorld Spaceに設定、適切なサイズにする(Rect Transform 1000×590、Scale 0.002 → 約2m幅)。
  2. シーンにEventSystemが存在することを確認。
  3. Canvasの下に以下を作成:
    • リスト用のTextMeshPro - Text (UI)を持つParticipantsパネル
    • 結果用のTextMeshPro - Text (UI)を持つDraw Resultパネル
    • 4つのボタン:Join Roulette、Leave Roulette、Draw a Couple (2 players)、Reset Roulette
  4. 空のGameObject CoupleRouletteManagerを作成し、スクリプトを追加(Create > U# Script経由)。
  5. インスペクタで、リストのテキスト → Participants List Text、結果のテキスト → Draw Result Text、Draw/Resetボタン(任意)をドラッグ。
  6. 各ボタンのButton > OnClick()で:CoupleRouletteManagerのGameObjectをドラッグし、SendCustomEvent (Dynamic string)を選び、イベント名(Join、Leave、DrawCouple、ResetRoulette)を入力。
  7. 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を使うか、友人にプライベートインスタンスで一緒にテストしてもらってください。