Complete the code to create a new folder named 'Scripts' inside the Assets folder.
using UnityEditor; public class CreateFolder { [MenuItem("Assets/Create/Scripts Folder")] public static void CreateScriptsFolder() { AssetDatabase.CreateFolder("Assets", "[1]"); } }
The folder name to create inside Assets is 'Scripts'.
Complete the code to load a prefab named 'Enemy' from the 'Prefabs' folder inside Assets.
using UnityEngine; public class LoadPrefab : MonoBehaviour { public GameObject enemyPrefab; void Start() { enemyPrefab = Resources.Load<GameObject>("[1]/Enemy"); } }
The prefab 'Enemy' is inside the 'Prefabs' folder, so the path is 'Prefabs/Enemy'.
Fix the error in the code to correctly save a new material asset inside the 'Materials' folder.
using UnityEditor; using UnityEngine; public class SaveMaterial { public static void CreateMaterial() { Material mat = new Material(Shader.Find("Standard")); AssetDatabase.CreateAsset(mat, "Assets/[1]/NewMaterial.mat"); AssetDatabase.SaveAssets(); } }
The material asset should be saved inside the 'Materials' folder.
Fill both blanks to create a dictionary that maps folder names to their typical content type.
var folderContent = new Dictionary<string, string> {
{"Scripts", "[1]"},
{"Prefabs", "[2]"}
};'Scripts' folder contains code files, and 'Prefabs' folder contains game objects.
Fill all three blanks to create a method that checks if a folder exists and creates it if missing.
using UnityEditor; public class FolderHelper { public static void EnsureFolder(string folderName) { if (!AssetDatabase.IsValidFolder($"Assets/[1]")) { AssetDatabase.CreateFolder("Assets", [2] + [3]); } } }
The method checks if 'Assets/folderName' exists. If not, it creates the folder inside 'Assets' with the name 'folderName'. The third blank is an empty string because no extra character is needed.