Spinning Cube

Checked with version: 3.5


Difficulty: Beginner


Date: 12 Mar 2014

The most basic of Unity challenges to get you started in coding - how to make a spinning cube.

Download Assets

Spinning Cube

Beginner Scripting


Code snippet

using UnityEngine;
using System.Collections;

public class Spin : MonoBehaviour
    public float speed = 10f;
    void Update ()
        transform.Rotate(Vector3.up, speed * Time.deltaTime);
#pragma strict

public var speed : float = 10f;

function Update ()
    transform.Rotate(Vector3.up, speed * Time.deltaTime);
import UnityEngine
import System.Collections

public class Spin(MonoBehaviour):

    public speed as single = 10.0F

    private def Update():
        transform.Rotate(Vector3.up, (speed * Time.deltaTime))
Simple Clock

Related tutorials

Related documentation

Got it

The Unity Software License Agreement and Privacy Policy have been updated.

We use cookies to ensure that we give you the best experience on our website. Click here for more information.