VRChat 非公式日本語ドキュメント

Udonの基本

このページでは、Udonの使用例を紹介します。すべての例は、Udon GraphまたはUdonSharpで確認できます。

回転する立方体

このビヘイビアは、ゲームオブジェクト(立方体など)をローカルY軸方向に1秒ごとに90度回転させます。

An Udon Graph for a spinning cube.

インタラクト

この挙動では Interact を使用して、プレイヤーがオブジェクトを操作して無効化できるようにします。例えば、プレイヤーがクリックした際にメッセージを消したり、ドアを消滅させたりといった用途に使用できます。プレイヤーがオブジェクトをインタラクトできるようにするには、そのゲームオブジェクトに Collider コンポーネントが設定されている必要があります。

An Udon Graph that disables an object when interacting with it. It has several comments. For example, it demonstrates that leaving "instance" empty in the "Get gameObject" node causes it to retrieve to game object that this script is attached to.

プレイヤーをテレポートさせる

この動作では InteractTeleportTo を使用してプレイヤーをテレポートさせます。targetPositon Transform は、テレポート後のプレイヤーの目的地となる位置と回転を決定します。targetPosition GameObject に Collider コンポーネントを追加するのを忘れないでください。

An Udon Graph program that teleports the player to a target position. Comment points out that "targetPosition" must be defined as "public" to allow setting it in the inspector for instances of this script.

イベントの送信

この挙動は、他のビヘイビアとやり取りする方法を示しています。UdonBehaviour同士は、変数やカスタムイベントを通じて通信を行うことができます。

An Udon Graph that communicates with other graph programs. Public variables and custom event names from other scripts are specified as constant strings and fed into the "symbolName" parameter of various nodes.

最終更新: