Unity Tutorial - 3D Spinning Cube in 10 minutes

Add a script

Let's create a script and add it to the cube.

  1. Select the Cube object in the Hierarchy window.

    The Unity scene hierarchy with a cube game object chosen

    You should see the Inspector window change to reflect the properties of the cube.

  2. On the Inspector window, select the Add component button at the bottom.

    The inspector window when the cube is selected with the Add Component button highlighted

    A new drop-down list appears.

  3. Enter the word new and choose New script.

    A menu to create a new script in the Unity editor

  4. Enter SpinCube as the name of the script and select the Create and Add button. This should add this new script to your cube.

    A menu to add a script to a game object in the Unity editor

  5. You should also see the script appear in your Assets folder in the Project window on the bottom of the editor.

    A script added to the Project window in the unity editor

    You're now ready to edit that script and create some movements!

Continue