0
0
Unityframework~20 mins

Unity Editor interface - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Unity Editor 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 Editor script?
Consider this Unity Editor script that adds a menu item. What will be printed in the Console when you click the menu item Tools/Show Message?
Unity
using UnityEditor;
using UnityEngine;

public class EditorTest
{
    [MenuItem("Tools/Show Message")]
    public static void ShowMessage()
    {
        Debug.Log("Hello from Unity Editor!");
    }
}
AMenu item not found error
BHello from Unity Editor!
CNothing happens
DCompilation error
Attempts:
2 left
💡 Hint
Look at the Debug.Log statement inside the method called by the menu item.
🧠 Conceptual
intermediate
1:30remaining
Which Unity Editor window is used to inspect and modify GameObject properties?
In the Unity Editor interface, which window lets you see and change the properties of a selected GameObject?
AProject window
BHierarchy window
CInspector window
DConsole window
Attempts:
2 left
💡 Hint
This window shows details about the selected object.
🔧 Debug
advanced
2:30remaining
Why does this custom Editor script cause an error?
This script tries to create a custom inspector for a component but causes an error. What is the cause?
Unity
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(MyComponent))]
public class MyComponentEditor : Editor
{
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();
        if (GUILayout.Button("Press Me"))
        {
            Debug.Log("Button pressed");
        }
    }
}

public class MyComponent : MonoBehaviour
{
    public int value;
}
AThe class MyComponentEditor must be inside an Editor folder
BMyComponent must inherit from Editor
CThe method OnInspectorGUI must return a value
DThe script is missing 'using UnityEditor;'
Attempts:
2 left
💡 Hint
Custom Editor scripts must be placed in a special folder.
📝 Syntax
advanced
2:00remaining
What error does this Unity Editor script produce?
What error will this script cause when compiled in Unity Editor?
Unity
using UnityEditor;
using UnityEngine;

public class EditorExample
{
    [MenuItem("Tools/Do Something")]
    public static void DoSomething()
    {
        Debug.Log("Doing something");
    }

    [MenuItem("Tools/Do Something", true)]
    public static bool ValidateDoSomething()
    {
        return false;
    }
}
ASyntaxError: missing semicolon or closing brace
BSyntaxError: missing return statement
CSyntaxError: missing colon
DSyntaxError: missing semicolon
Attempts:
2 left
💡 Hint
Check the last line of the ValidateDoSomething method.
🚀 Application
expert
3:00remaining
How many items will appear in the Unity Editor's Project window after this script runs?
This Editor script creates assets in the Project window. How many assets will be visible after running the script?
Unity
using UnityEditor;
using UnityEngine;

public class AssetCreator
{
    [MenuItem("Tools/Create Assets")]
    public static void CreateAssets()
    {
        for (int i = 0; i < 3; i++)
        {
            var asset = ScriptableObject.CreateInstance<ScriptableObject>();
            AssetDatabase.CreateAsset(asset, $"Assets/Asset{i}.asset");
        }
        AssetDatabase.SaveAssets();
    }
}
A3
B4
C1
D0
Attempts:
2 left
💡 Hint
Count how many times the loop runs and creates assets.