Creating Collectable Objects

확인 완료한 버전: 5.2

-

난이도: 초급

In this assignment we'll add collectable objects to our 2D UFO game in progress. We'll use Prefabs, 2D trigger colliders to do this, and add a one line C# script to make the collectable objects rotate.

Creating Collectable Objects

초급 2D UFO tutorial

트랜스크립트

Code snippet

using UnityEngine;
using System.Collections;

public class CompleteRotator : MonoBehaviour {

    //Update is called every frame
    void Update () 
    {
        //Rotate thet transform of the game object this is attached to by 45 degrees, taking into account the time elapsed since last frame.
        transform.Rotate (new Vector3 (0, 0, 45) * Time.deltaTime);
    }
}