Spinning Cube

Checked with version: 3.5


Difficulty: Beginner

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

Related tutorials

Related documentation

Got it

We’ve updated our Terms of Service and software agreement to reflect recent changes to our business model. We’ve also updated our Privacy Policy to better reflect our current data collection and use practices.

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