P1-M02
[UNITY]ピンボールゲームを作る1/3
![](https://digilab.tech/materials/wp-content/uploads/2018/06/Create@2x.png)
1
ゲームの新規作成
Unityを起動してNewボタンをクリックして新規作成します。
![](https://digilab.tech/materials/wp-content/uploads/2018/06/A09_01.png)
プロジェクト名を入力して「Create Project」をクリックします。
![](https://digilab.tech/materials/wp-content/uploads/2018/06/A09_02.png)
2
使用するファイルをダウンロードする
3
Sceneの新規作成
Project > Create > Scene でシーンを作成します。作ったシーンをダブルクリックして開きます。
![](https://digilab.tech/materials/wp-content/uploads/2018/06/A09_04_02_シーン.png)
![](https://digilab.tech/materials/wp-content/uploads/2018/06/A09_04_シーン.png)
4
ゲームオブジェクト(ピンボール台)の追加
まず、Hierarchy > Create Empty でピンボールで使うオブジェクトをいれるためのゲームオブジェクト「Pinball」を作成します。
![](https://digilab.tech/materials/wp-content/uploads/2018/06/A09_05_ゲームオブジェクト_新規作成.png)
![](https://digilab.tech/materials/wp-content/uploads/2018/06/A09_06_ピンボール下配置.png)
まず「PinballV4」と「PinballV4Collider」をProjectからHierarchyへアタッチします。
![](http://digilab.tech/materials/wp-content/uploads/2018/05/A09_06_02.png)
「PinvallV4Collider」はコライダー生成用の3Dデータです。PinvallV4Collider > default と選択し、メッシュコライダーを Inspector > Add Component > Mesh Collider で追加します。
5
ゲームオブジェクト(ボール)の追加
6
ボールを弾くためのスクリプトを追加
![](https://digilab.tech/materials/wp-content/uploads/2018/06/Coding@2x.png)
ボールを弾くためのスクリプトをコーディングしていきます。
7
作成したスクリプトをボールにアタッチする
8
スクリプト内でpublicになっている変数を指定する
9
ゲームを再生してテストしてみよう