0
0
Unityframework~20 mins

Project structure and folders in Unity - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Unity Project Structure 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 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);
    }
}
A"C:/Users/Username/Projects/MyUnityProject/Assets"
B"C:/Users/Username/Projects/MyUnityProject"
C"Assets"
D"C:/Program Files/Unity/Editor"
Attempts:
2 left
💡 Hint
Application.dataPath returns the full path to the Assets folder inside your project.
🧠 Conceptual
intermediate
1: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?
AAssets/Scripts
BAssets/Plugins
CAssets/Resources
DAssets/Editor
Attempts:
2 left
💡 Hint
Editor scripts must be separated to avoid being included in the game build.
🔧 Debug
advanced
2: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!");
}
AThe prefab is inside 'Assets/Resources/Prefabs' but code uses "Enemy" instead of "Prefabs/Enemy".
BResources.Load only works for textures, not prefabs.
CThe prefab file is named 'enemy.prefab' with lowercase 'e'.
DThe prefab is not inside a folder named 'Resources' anywhere in Assets.
Attempts:
2 left
💡 Hint
Resources.Load path is relative to the Resources folder and must include subfolders.
📝 Syntax
advanced
2: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?
AAssetDatabase.CreateFolder("Assets/NewFolder", "");
BAssetDatabase.CreateFolder("Assets", "NewFolder");
CDirectory.CreateDirectory("Assets/NewFolder");
DAssetDatabase.CreateFolder("NewFolder", "Assets");
Attempts:
2 left
💡 Hint
AssetDatabase.CreateFolder takes the parent folder path and the new folder name separately.
🚀 Application
expert
1: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");
A1
B0
C3
DDepends on the number of scripts in the Enemies folder
Attempts:
2 left
💡 Hint
Resources.LoadAll loads all assets of the specified type in the given folder.