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);
    }
}

Связанные обучающие материалы