CodeBlanks Logo Icon CodeBlanks

Testing in Play mode

Learn to enter Play mode and test the scene.

Play mode

The Play button on the Toolbar starts the game and switches the scene into Play mode. In Play mode the scene runs like a real game; you can still select objects and watch their values. When the test is over, press the same button again to return to Edit mode.

Edit modu -> nesneleri duzenlersin
Play modu -> sahneyi test edersin

When the Play button turns blue, you know the game is running.

Reset

Changes you make in Play mode are not permanent. When you exit Play, the scene returns to the state it had before you pressed Play; this is called a reset. Because of this, you should always make lasting changes in Edit mode.

Play  -> kupun konumunu degistir
Cikis -> konum eski haline doner

For example, if you move the cube during Play, it will be back at its old place when you exit.

Practice Print the scene test

Define an array named testler holding "Kamera", "Isik", and "Kup". With a loop, print a line for every test in the form Test: Kamera - gecti (the name changes per line). Add a final line Sahne testi tamamlandi. Expected output:

Test: Kamera - gecti
Test: Isik - gecti
Test: Kup - gecti
Sahne testi tamamlandi

Starter code

Player.cs
using System;

class Test {
    static void Main() {
        // "Kamera", "Isik", "Kup" adlarini bir diziye koy
        // Her oge icin "Test: ad - gecti" satirini yazdir
        // En sona kapanis satirini ekle
    }
}

Sample solution

Player.cs
using System;

class Test {
    static void Main() {
        string[] testler = { "Kamera", "Isik", "Kup" };
        foreach (string test in testler) {
            Console.WriteLine("Test: " + test + " - gecti");
        }
        Console.WriteLine("Sahne testi tamamlandi");
    }
}

Expected output

Test: Kamera - gecti
Test: Isik - gecti
Test: Kup - gecti
Sahne testi tamamlandi

Questions and answers

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

1 What happens when you press the Play button?

  • The scene is saved permanently
  • All objects are removed from the scene
  • A new project is created
  • The scene switches to Play mode and the game runs Correct answer

Explanation: The Play button starts the game; the scene enters Play mode and the objects start behaving like in a game.

2 The result of exiting Play

Question
string cikisSonucu = "____";
Answer
string cikisSonucu = "konum eski haline doner";

Explanation: Changes made in Play mode are not permanent; when you exit Play, the scene returns to its previous state.

3 Play mode terms

Term Meaning
Play düğmesi Starts and stops the game
Play modu The state where the scene is tested
Edit modu The state where objects are edited
Reset Reverts the changes made during Play

All lessons in Beginner