Consider this simple Unity script attached to a GameObject. What will be printed in the Console when you run the scene?
using UnityEngine; public class HelloWorld : MonoBehaviour { void Start() { Debug.Log("Hello, Unity World!"); } }
Look at what Debug.Log prints inside the Start method.
The Start method runs once when the scene starts. Debug.Log prints the exact string to the Console, so it prints "Hello, Unity World!".
In Unity scripts, which method is called automatically once when the scene begins?
Think about the method that runs after all Awake methods but before the first frame.
Start() is called once before the first frame update. Awake() runs earlier but also once. However, Start() is the common method to initialize things when the scene starts.
Look at this script attached to a GameObject. Why does it not print "Hello World" when the scene runs?
using UnityEngine; public class HelloWorld : MonoBehaviour { void start() { Debug.Log("Hello World"); } }
Unity calls specific methods by exact names and capitalization.
Unity calls the Start() method with capital S automatically. The method named start() with lowercase s is ignored, so nothing prints.
This script has a syntax error. Choose the option that fixes it so it compiles and prints "Hello World".
using UnityEngine; public class HelloWorld : MonoBehaviour { void Start() { Debug.Log("Hello World" } }
Check if all parentheses and semicolons are correctly placed.
The Debug.Log call is missing a closing parenthesis and semicolon. Adding them fixes the syntax error.
This script creates new GameObjects in the scene. How many GameObjects exist after Start() finishes?
using UnityEngine; public class CreateObjects : MonoBehaviour { void Start() { for (int i = 0; i < 3; i++) { GameObject obj = new GameObject($"Object_{i}"); } } }
Remember the original GameObject with this script plus the new ones created.
The script creates 3 new GameObjects plus the original GameObject that has this script attached, so total 4 GameObjects exist.