
収集アイテムの作成
Tutorial
Beginner
+10XP
15 mins
(53)
Unity Technologies

本チュートリアルでは、以下のことを行います:
- プレイヤーが収集するための PickUp ゲームオブジェクトの作成
- 収集アイテムを回転させるスクリプトを書く
- PickUp ゲームオブジェクトをプレハブにする
- プレイエリア周辺のプレハブをインスタンス化する
Resources
1. 収集するゲームオブジェクトの作成
2. PickUp ゲームオブジェクトを回転させる
Rotator スクリプト
using UnityEngine;
using System.Collections;
public class Rotator : MonoBehaviour {
// Before rendering each frame..
void Update ()
{
// Rotate the game object that this script is attached to by 15 in the X axis,
// 30 in the Y axis and 45 in the Z axis, multiplied by deltaTime in order to make it per second
// rather than per frame.
transform.Rotate (new Vector3 (15, 30, 45) * Time.deltaTime);
}
}