Creating Collectable Objects

Revisado con versión: 5.2

-

Dificultad: Principiante

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

Principiante 2D UFO tutorial

Transcripciones

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