📖 Scenario: You are creating your first Unity project to display a simple "Hello World" message in a 3D scene. This is like putting up a sign in a park that says "Hello World" for everyone to see.
🎯 Goal: Build a Unity scene that shows a 3D text object with the exact message "Hello World" visible in the game view.
📋 What You'll Learn
Create a new Unity scene with a 3D Text object
Set the text content to "Hello World"
Position the text so it is visible in the main camera view
Add a simple script to control the text if needed
💡 Why This Matters
🌍 Real World
Creating simple 3D text displays is common in games and interactive apps to show messages, instructions, or titles.
💼 Career
Understanding how to set up scenes, add objects, and write scripts is foundational for Unity developers building interactive experiences.
Progress0 / 4 steps
1
Create a new Unity scene and add a 3D Text object
In your Unity project, create a new scene. Then add a 3D Text object named helloText to the scene hierarchy.
Unity
Hint
Use the Unity Editor menus to create a new scene and add a TextMeshPro 3D text object. Rename it exactly to helloText.
2
Set the text content to "Hello World"
Select the helloText object and set its text content property to the exact string "Hello World".
Unity
Hint
Look in the Inspector panel for the helloText object. Find the Text field and type exactly "Hello World".
3
Position the text so it is visible in the main camera view
Set the helloText object's position to (0, 0, 5) so it appears in front of the main camera at (0, 0, 0).
Unity
Hint
In the Transform component of helloText, set the X and Y to 0 and Z to 5 so the text is in front of the camera.
4
Add a simple script to rotate the text slowly
Create a new C# script named HelloWorldRotator and attach it to helloText. In the script, write code to rotate the text around the Y-axis by 20 degrees per second.
Unity
Hint
Create a new C# script file named HelloWorldRotator.cs. Use the Update() method to rotate the object smoothly every frame.
Practice
(1/5)
1. What is the main purpose of creating a Hello World scene in your first Unity project?
easy
A. To display a simple message on the screen and learn basic Unity setup
B. To create a full game with levels and enemies
C. To design complex 3D models
D. To write advanced shaders for graphics
Solution
Step 1: Understand the goal of a first Unity project
The first project is usually simple to help beginners learn the basics of scenes and UI.
Step 2: Identify what a Hello World scene does
It shows a simple message like "Hello World!" on screen to confirm everything works.
Final Answer:
To display a simple message on the screen and learn basic Unity setup -> Option A
Quick Check:
First project = simple message display [OK]
Hint: First project means simple message, not full game [OK]
Common Mistakes:
Thinking Hello World is a full game
Confusing UI design with 3D modeling
Trying to write shaders too early
2. Which of the following is the correct way to display "Hello World!" text using TextMeshPro in Unity C# script?
easy
A. textMeshProUGUI.text = Hello World!;
B. textMeshProUGUI.setText("Hello World!");
C. textMeshProUGUI.text = "Hello World!";
D. textMeshProUGUI.text = 'Hello World!';
Solution
Step 1: Recall correct syntax for assigning string in C#
Strings must be in double quotes and assigned with = operator.
Step 2: Check TextMeshPro property usage
The correct property to change text is .text, so textMeshProUGUI.text = "Hello World!"; is correct.
Final Answer:
textMeshProUGUI.text = "Hello World!"; -> Option C
Quick Check:
Assign string with .text and double quotes [OK]
Hint: Use .text with double quotes for strings in C# [OK]
Common Mistakes:
Using single quotes for strings in C#
Missing quotes around Hello World!
Using a non-existent setText method
3. Given this Unity C# script attached to a GameObject with a TextMeshProUGUI field linked:
using TMPro;
using UnityEngine;
public class HelloWorld : MonoBehaviour {
public TextMeshProUGUI messageText;
void Start() {
messageText.text = "Hello World!";
}
}
What will appear on the screen when you run the scene?
medium
A. The text "messageText" will appear instead
B. Nothing will appear because Start() is not called
C. A compile error due to missing semicolon
D. The text "Hello World!" will appear on the UI
Solution
Step 1: Understand the Start() method in Unity
Start() runs once when the scene starts, so the text assignment happens immediately.
Step 2: Check the text assignment
The script sets messageText.text to "Hello World!", so that exact text will show on the UI.
Final Answer:
The text "Hello World!" will appear on the UI -> Option D
Quick Check:
Start() sets text to "Hello World!" [OK]
Hint: Start() runs once, sets text to Hello World [OK]
Common Mistakes:
Thinking Start() does not run automatically
Confusing variable name with displayed text
Assuming compile error without checking code
4. You wrote this script to show "Hello World!" but the text does not appear:
using TMPro;
using UnityEngine;
public class HelloWorld : MonoBehaviour {
public TextMeshProUGUI messageText;
void Start() {
messageText.text = "Hello World!";
}
}
What is the most likely reason the text is not showing?
medium
A. The messageText variable should be private
B. The TextMeshProUGUI field is not linked to the UI text in the Inspector
C. The Start() method is misspelled
D. The script is missing a semicolon after the text assignment
Solution
Step 1: Check common reasons for UI text not updating
If the public field is not linked in Inspector, messageText is null and text won't show.
Step 2: Verify code correctness
The code syntax is correct, Start() is spelled right, and variable privacy does not affect linking.
Final Answer:
The TextMeshProUGUI field is not linked to the UI text in the Inspector -> Option B
Quick Check:
Unlinked UI field = no text shown [OK]
Hint: Always link public UI fields in Inspector [OK]
Common Mistakes:
Assuming syntax errors without checking code
Thinking private variables must be used
Ignoring Inspector linking step
5. You want to create a Hello World scene that changes the text to "Welcome!" when the user clicks a button. Which approach correctly combines UI and scripting in Unity?
hard
A. Create a public method in a script that sets the TextMeshProUGUI text, then link this method to the button's OnClick event
B. Write code in Start() to change text and expect it to update on button click automatically
C. Change the button text directly without scripting
D. Use Update() method to constantly set text to "Welcome!"
Solution
Step 1: Understand how button clicks trigger actions
Unity buttons use OnClick events to call public methods in scripts.
Step 2: Identify correct way to change UI text on click
Write a public method that sets the TextMeshProUGUI text to "Welcome!" and link it to the button's OnClick.
Final Answer:
Create a public method in a script that sets the TextMeshProUGUI text, then link this method to the button's OnClick event -> Option A
Quick Check:
Button OnClick calls public method to change text [OK]
Hint: Use button OnClick to call public method changing text [OK]
Common Mistakes:
Expecting Start() to handle button clicks
Changing button text instead of target text
Using Update() unnecessarily causing performance issues
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.