0
0
Unityframework~20 mins

First Unity project (Hello World scene) - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Unity Hello World Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
What is the output of this Unity C# script?

Consider this simple Unity script attached to a GameObject. What will be printed in the Console when you run the scene?

Unity
using UnityEngine;

public class HelloWorld : MonoBehaviour
{
    void Start()
    {
        Debug.Log("Hello, Unity World!");
    }
}
AHello, Unity World!
BError: Debug.Log is undefined
CNothing is printed
DHello World
Attempts:
2 left
💡 Hint

Look at what Debug.Log prints inside the Start method.

🧠 Conceptual
intermediate
1:30remaining
Which Unity method runs exactly once when the scene starts?

In Unity scripts, which method is called automatically once when the scene begins?

AFixedUpdate()
BUpdate()
CStart()
DAwake()
Attempts:
2 left
💡 Hint

Think about the method that runs after all Awake methods but before the first frame.

🔧 Debug
advanced
2:30remaining
Why does this script not print anything in the Console?

Look at this script attached to a GameObject. Why does it not print "Hello World" when the scene runs?

Unity
using UnityEngine;

public class HelloWorld : MonoBehaviour
{
    void start()
    {
        Debug.Log("Hello World");
    }
}
AThe method name should be capitalized as Start() to be called by Unity.
BDebug.Log cannot print strings, only numbers.
CThe script must inherit from ScriptableObject, not MonoBehaviour.
DThe GameObject is inactive, so scripts never run.
Attempts:
2 left
💡 Hint

Unity calls specific methods by exact names and capitalization.

📝 Syntax
advanced
2:00remaining
Which option fixes the syntax error in this Unity C# script?

This script has a syntax error. Choose the option that fixes it so it compiles and prints "Hello World".

Unity
using UnityEngine;

public class HelloWorld : MonoBehaviour
{
    void Start()
    {
        Debug.Log("Hello World"
    }
}
ARemove the semicolon after Debug.Log("Hello World")
BChange Debug.Log to Debug.Print("Hello World");
CAdd a return type int to Start method: int Start()
DAdd a closing parenthesis after the string: Debug.Log("Hello World");
Attempts:
2 left
💡 Hint

Check if all parentheses and semicolons are correctly placed.

🚀 Application
expert
3:00remaining
How many GameObjects are created after running this script?

This script creates new GameObjects in the scene. How many GameObjects exist after Start() finishes?

Unity
using UnityEngine;

public class CreateObjects : MonoBehaviour
{
    void Start()
    {
        for (int i = 0; i < 3; i++)
        {
            GameObject obj = new GameObject($"Object_{i}");
        }
    }
}
A3 GameObjects named Object_0, Object_1, Object_2
B4 GameObjects including the one with this script attached
C1 GameObject named Object_2 because previous are overwritten
D0 GameObjects because new GameObject() does not add to scene
Attempts:
2 left
💡 Hint

Remember the original GameObject with this script plus the new ones created.