CodeBlanks Logo Icon CodeBlanks

Your first cube in the scene

Add your first cube via GameObject > 3D Object > Cube.

The GameObject menu

The GameObject menu is the way to add new objects to the scene. Right-clicking an empty area of the Hierarchy window opens the same options. Cube under 3D Object adds a cube to the scene.

GameObject > 3D Object > Cube

The new cube is listed in the Hierarchy as Cube and appears at the center of the scene.

Transform

Every object's position, rotation, and size are held by its Transform. Position is where the object stands, Rotation is which way it faces, and Scale is how big it is. A newly added cube has a Scale of 1, 1, 1.

Cube
Position: X = 0, Y = 0, Z = 0
Rotation: X = 0, Y = 0, Z = 0
Scale:    X = 1, Y = 1, Z = 1

When you change these values in the Inspector, the cube updates its place in the scene right away.

Practice Print the cube info

Define a kupAdi variable holding "Cube". Keep the position values as three int variables: x = 0, y = 0, z = 0. Print the name and the position on one line. Expected output:

Cube konumu: 0, 0, 0

Starter code

Player.cs
using System;

class Kup {
    static void Main() {
        // Kupun adini "Cube" olarak bir string degiskende tut
        // x, y, z degerlerini 0 olarak tanimla
        // Ad ve konumu tek satirda yazdir
    }
}

Sample solution

Player.cs
using System;

class Kup {
    static void Main() {
        string kupAdi = "Cube";
        int x = 0, y = 0, z = 0;
        Console.WriteLine(kupAdi + " konumu: " + x + ", " + y + ", " + z);
    }
}

Expected output

Cube konumu: 0, 0, 0

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What happens when you follow GameObject > 3D Object > Cube?

  • The project files are deleted
  • A new scene is opened
  • A cube is added to the scene Correct answer
  • The camera is moved out of the scene

Explanation: This path adds a cube of default size to the scene; the cube appears in the Hierarchy as Cube.

2 Complete the cube's menu path

Question
string menuYolu = "GameObject > 3D Object > ____";
Answer
string menuYolu = "GameObject > 3D Object > Cube";

Explanation: The Cube option under GameObject > 3D Object adds a cube to the scene; the other options create different 3D objects.

3 Cube and Transform

Term Meaning
GameObject menüsü Adds objects to the scene
Position The cube's place in the scene
Rotation The direction the cube faces
Scale The size of the cube

All lessons in Beginner