VRChat開発メモ（Udon編、Unity 2018.4.20f1、VRCSDK3）

# VRChat Examples
VRCSDK3のサンプルシーンをやっていきます

## 開発環境
- Windows10 PC
- Unity 2018.4.20f1
- VRCSDK3（VRCSDK3-UDON-2020.04.25.13.00.unitypackage）
- Steam 
- VRChat

# Prefabs
座れる椅子、トグルスイッチでオンオフできる鏡、アバター着替えの3つの代表的なプレハブ。

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/d554538a-3376-b658-a5e2-43427605b05e.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/bff4d086-d0c2-f399-a601-042d87f43808.png)

VRCChair3 -> StationGraph
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/f313b8d4-0165-3bcc-375f-ce3940a2a026.png)

MirrorSystem -> ToggleGameObject
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/57a0e464-3cf2-5fc7-5c53-155097a35438.png)

AvatarPedestal -> AvatarPedestal Program
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/40aafd73-71de-44e9-155a-f5e7e8d19374.png)
 
# MultiExample
物を拾う機能、マウスクリック（遠くからでも発火？）で色が変わる、タイマーで色が変わる、インタラクティブなクリック（近づいたらナビゲーションの表示とクリックで発火）で色が変わる、Click For Loopはよくわからないｗ

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/d067e3a4-93d7-aa8d-5a83-2732641d1991.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/362d020f-b3e7-9df3-2e52-3ca963e3ec6b.png)

ClickableCube -> SendEventOnMouseDown

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/77e54a69-4e84-9c6a-14e8-5ed4d92be155.png)

TimerCube -> SendEventOnTimer
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/31da4dd4-f7f8-8533-1213-35670a4fa861.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/f6349e92-dab0-da9b-7b1b-68c5ba143ad7.png)

InteractCube -> SendEventOnInteract

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/0ff405a8-f80b-94fe-4bb7-09f901c9f78a.png)

PickupCube -> PickupAndUse
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/42300abc-9733-0aa5-5b2c-25f6588802cc.png)
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/e3a8c27e-e5c8-8bb2-9fd8-5d5709b9ca45.png)

ClickableCubeForLoop -> SendEventOnMouseDown

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/95d52a5d-e197-ba06-b7d4-5068b214f129.png)

# SyncUI
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/b732cf55-f77e-1dd8-ad0f-7821aa9bcee0.png)

Masterがボタンをクリックできる。クリックした回数を表示する。
ButtonSyncMaster
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/78855c45-7a00-5edb-4b7e-7cb40105a396.png)


誰でもクリックできるボタン。クリックした回数を表示する。
ButtonSyncAnyone
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/868c2695-402b-76e1-e37d-3faeb5b2f847.png)

スライダー
SliderSync
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/d6bebcb1-1788-a6fa-128c-eea94e828cd4.png)

トグルボタン
Toggle
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/a61f9479-284e-0eae-bcc7-83b99e053c40.png)

ドロップダウンメニュー
Dropdown
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/f6c01bc3-7ad7-2202-6956-896fb762d7af.png)

テキスト入力フィールド
InputField

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/1708bdcd-8755-46b7-1ce5-ee3d0aeaa989.png)

クリックでCubeを把持。右クリックでドロップすると、重力で落ちる。
PickupCube
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/a938bac7-3983-56a7-1a35-a89a9d41c24a.png)

マウスダウンの間Sphereを把持。投げることができる。
PickupSphere
UdonBehaviorはEmpty

# SyncValueTypes
これはよくわからなかった。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/e6c5a3eb-b971-7b9b-8608-6d801e77b0ed.png)

# SpinningCubeSeries

## SCS_1_Introduction

Cube -> 1_RotateCube
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/17a36307-9712-554f-4205-b9346002dc29.png)

## SCS_2_Input_And_Flow

Cube -> 2_RotateCubeMultiplication
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/3b80f892-e5bf-4d7e-416d-14a1013219ac.png)

## SCS_4_Program_Variables
Signal_CubeのspeedPublic変数を変えると良さそうだけどよくわからなかった

Signal_Cube -> 4_SetProgramVariable
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/93c1a16f-5013-2e7a-2641-3ff5a755124d.png)

Rotating_Cube -> 4_GetProgramVariable
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/3fe8caa0-33c1-35e1-88f2-28334d798ada.png)

## SCS_5_Custom_Events
大きいCubeをマウスでクリックすると、小さいCubeが回転する

Cube -> 5_RotateCubeMaster
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/581d3d5a-5fe4-b669-be6c-4d4412a850d1.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/4c4463a1-264d-a5ae-36a3-94d64db23aab.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/c1d75996-d4a8-547f-314c-ce9d53e79aed.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/5f653596-ae74-f363-8651-4ca6c13e159f.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/1a4efeec-7f3a-8ad1-51a3-cbc106c2f68f.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/26ae1b3f-59f9-5a28-9721-0283c6778cef.png)

SmallCube -> 5_RotateCubeDependent
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/7e57a203-8600-2979-3dbf-a785f7ff4c1b.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/63863/75002d2a-cea4-0fc2-adf0-4c3737d55099.png)

# 実行

実行結果の動画を下記ツイートにまとめてます。
<blockquote class="twitter-tweet"><p lang="en" dir="ltr">VRChat Examples-&gt;SpinningCubeSeries-&gt;SCS_1_Introduction<a href="https://twitter.com/hashtag/VRChat?src=hash&amp;ref_src=twsrc%5Etfw">#VRChat</a> <a href="https://twitter.com/hashtag/Udon?src=hash&amp;ref_src=twsrc%5Etfw">#Udon</a> <a href="https://twitter.com/hashtag/Unity?src=hash&amp;ref_src=twsrc%5Etfw">#Unity</a> <a href="https://t.co/JHF9FZljK6">pic.twitter.com/JHF9FZljK6</a></p>&mdash; 藤本賢志(ガチ本)@pixivFANBOXはじめました (@sotongshi) <a href="https://twitter.com/sotongshi/status/1257288283714805760?ref_src=twsrc%5Etfw">May 4, 2020</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>