Challenge - 5 Problems
Unity Project Structure Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this Unity C# script regarding folder paths?
Consider this Unity C# code that prints the path of the Assets folder. What will it output when run inside the Unity Editor?
Unity
using UnityEngine;
public class PathPrinter : MonoBehaviour {
void Start() {
Debug.Log(Application.dataPath);
}
}Attempts:
2 left
💡 Hint
Application.dataPath returns the full path to the Assets folder inside your project.
✗ Incorrect
Application.dataPath gives the full system path to the Assets folder of the current Unity project. It does not return just the project root or the Editor folder.
🧠 Conceptual
intermediate1:30remaining
Which folder in a Unity project is used to store scripts that run in the Editor only?
In Unity, where should you place scripts that should only run inside the Editor and not in the final game build?
Attempts:
2 left
💡 Hint
Editor scripts must be separated to avoid being included in the game build.
✗ Incorrect
The 'Assets/Editor' folder is special. Unity compiles scripts here only for the Editor and excludes them from builds.
🔧 Debug
advanced2:30remaining
Why does this script fail to load a prefab from Resources folder?
This Unity C# code tries to load a prefab named 'Enemy' from the Resources folder but returns null. What is the likely cause?
Unity
GameObject enemyPrefab = Resources.Load<GameObject>("Enemy"); if(enemyPrefab == null) { Debug.Log("Prefab not found!"); }
Attempts:
2 left
💡 Hint
Resources.Load path is relative to the Resources folder and must include subfolders.
✗ Incorrect
If the prefab is inside a subfolder of Resources, the path must include that subfolder name. Using just "Enemy" misses the folder.
📝 Syntax
advanced2:00remaining
Which code snippet correctly creates a new folder inside the Assets folder in Unity Editor?
You want to create a new folder named 'NewFolder' inside the Assets folder using an Editor script. Which code is correct?
Attempts:
2 left
💡 Hint
AssetDatabase.CreateFolder takes the parent folder path and the new folder name separately.
✗ Incorrect
The correct method call is AssetDatabase.CreateFolder with the parent folder path and the new folder name as two separate arguments.
🚀 Application
expert1:30remaining
How many items will be in the list after loading all assets from a Resources subfolder?
Assume you have 3 prefabs inside 'Assets/Resources/Enemies'. You run this code:
var enemies = Resources.LoadAll("Enemies");
How many items does 'enemies' contain?
Unity
var enemies = Resources.LoadAll<GameObject>("Enemies");Attempts:
2 left
💡 Hint
Resources.LoadAll loads all assets of the specified type in the given folder.
✗ Incorrect
Resources.LoadAll("Enemies") loads all GameObject assets inside the 'Enemies' folder under Resources. Since there are 3 prefabs, the list has 3 items.