




















































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The exam assesses core Unity engine programming skills, including C# scripting, game object management, animation controls, physics simulation, UI programming, asset optimization, and debugging. Scenario-based questions replicate real development challenges like game logic implementation, performance tuning, and cross-platform deployment considerations.
Typology: Exams
1 / 92
This page cannot be seen from the preview
Don't miss anything!





















































































Question 1. Which Unity lifecycle method is called exactly once before any Start methods are executed, even if the script component is disabled? A) Awake B) OnEnable C) Start D) Reset Answer: A Explanation: Awake is invoked when the script instance is being loaded, regardless of the component’s enabled state, making it ideal for initialization that must occur before any Start calls. Question 2. In C#, which access modifier allows a field to be edited in the Unity Inspector but not accessed directly from other scripts? A) public B) private C) protected D) [SerializeField] private Answer: D Explanation: Adding the SerializeField attribute to a private field exposes it to the Inspector while keeping it inaccessible to other scripts. Question 3. Which of the following statements about Unity’s FixedUpdate method is true? A) It runs once per rendered frame. B) It is called after all Update calls. C) It is synchronized with the physics engine’s time step. D) It should be used for UI animations.
Answer: C Explanation: FixedUpdate is invoked at a fixed interval matching the physics simulation step, ensuring consistent physics behavior. Question 4. What is the primary advantage of using a List over an array in Unity? A) Faster element access B) Fixed size at compile time C) Automatic resizing D) Lower memory overhead Answer: C Explanation: List can dynamically grow or shrink, eliminating the need to know the collection size beforehand, unlike fixed-size arrays. Question 5. Which method would you use to retrieve a component of type Rigidbody attached to the same GameObject without incurring a performance penalty on subsequent calls? A) GetComponent() each frame B) FindObjectOfType() C) Cache the result in a private variable during Awake D) Use GameObject.Find("Rigidbody") Answer: C Explanation: Caching the component reference in Awake avoids repeated costly GetComponent calls during runtime. Question 6. When scripting movement using Transform.Translate, which space parameter ensures movement is relative to the object’s current rotation? A) Space.World
Question 9. Which method is called when a Collider marked as “Is Trigger” begins overlapping another Collider? A) OnCollisionEnter B) OnTriggerEnter C) OnCollisionStay D) OnTriggerStay Answer: B Explanation: OnTriggerEnter fires when a trigger collider first overlaps another collider. Question 10. What does the NavMeshAgent component’s “auto-brake” property control? A) Whether the agent stops automatically when reaching its destination B) The speed of the agent’s movement C) The agent’s ability to jump over obstacles D) How the agent avoids other agents Answer: A Explanation: Auto-brake makes the agent decelerate as it approaches its target, preventing overshoot. Question 11. Which C# collection type provides O(1) lookup time when accessing values by a unique key? A) List B) Array C) Dictionary D) Queue Answer: C
Explanation: Dictionaries use hash tables, offering constant-time key-based retrieval. Question 12. Which Unity API method should be used to load a new scene asynchronously while displaying a loading screen? A) SceneManager.LoadScene B) SceneManager.LoadSceneAsync C) Application.LoadLevelAsync D) Application.LoadLevel Answer: B Explanation: LoadSceneAsync loads the scene in the background, allowing you to update UI during the process. Question 13. In the new Input System, what is the purpose of an Input Action Asset? A) To store key bindings for the legacy Input Manager B) To define reusable input actions and their bindings C) To automatically generate UI buttons D) To replace all MonoBehaviour scripts Answer: B Explanation: An Input Action Asset groups actions (e.g., “Jump”) with their bindings, enabling modular input handling. Question 14. Which of the following statements about PlayerPrefs is correct? A) It can store complex objects directly. B) It is encrypted by default. C) It is suitable for saving large amounts of data.
A) FixedUpdate runs after rendering, improving visual fidelity. B) Forces applied in FixedUpdate are processed consistently with the physics timestep. C) Update cannot access Rigidbody components. D) FixedUpdate runs only when the game is paused. Answer: B Explanation: Applying forces in FixedUpdate ensures they are integrated with the physics simulation at a constant rate. Question 18. Which shader property name would you modify via script to change the main texture’s offset? A) _MainTex B) _MainTex_ST C) _MainTexOffset D) _MainTex_Tiling Answer: B Explanation: Unity stores texture offset and tiling in the “_MainTex_ST” vector; modifying its x and y components changes the offset. Question 19. What is the effect of setting a Rigidbody’s “isKinematic” flag to true? A) The Rigidbody will be affected by gravity and forces. B) The Rigidbody will ignore collisions. C) The Rigidbody will be driven only by script-controlled Transform changes. D) The Rigidbody will automatically follow NavMeshAgents. Answer: C Explanation: A kinematic Rigidbody does not respond to physics forces; its movement must be set manually.
Question 20. Which method is called when a Scene is unloaded using SceneManager.UnloadSceneAsync? A) OnDisable B) OnDestroy C) OnSceneUnloaded (MonoBehaviour) D) There is no specific MonoBehaviour callback; use SceneManager.sceneUnloaded event. Answer: D Explanation: Unity provides the sceneUnloaded event for cleanup; MonoBehaviour does not receive a dedicated callback. Question 21. Which of the following best describes the purpose of a ScriptableObject in Unity? A) To store per-instance data on GameObjects. B) To create reusable data assets that are not attached to GameObjects. C) To replace MonoBehaviour for performance gains. D) To render UI elements. Answer: B Explanation: ScriptableObjects are asset files that hold data independent of scene objects, enabling shared configurations. Question 22. When using Physics.Raycast, which parameter determines the maximum distance the ray will travel? A) origin B) direction C) maxDistance D) layerMask
C) otherScript.OnJump.Subscribe(JumpHandler); D) otherScript.OnJump.Register(JumpHandler); Answer: B Explanation: UnityEvent uses AddListener to attach callbacks. Question 26. What does the attribute [RequireComponent(typeof(AudioSource))] do when placed on a MonoBehaviour class? A) Automatically adds an AudioSource component to any GameObject that has the script. B) Prevents the script from compiling if an AudioSource is missing. C) Makes the AudioSource field read-only. D) Sends a warning in the console if the component is absent. Answer: A Explanation: RequireComponent forces Unity to add the specified component if it’s not already present. Question 27. Which of the following best describes the difference between OnCollisionEnter and OnCollisionEnter2D? A) One works with 3D colliders, the other with 2D colliders. B) They are identical; the naming is historical. C) OnCollisionEnter2D is called only on triggers. D) OnCollisionEnter works only on static objects. Answer: A Explanation: The 2D version is used with Unity’s 2D physics system (Collider2D, Rigidbody2D).
Question 28. When using Unity’s Profiler, which module would you examine to identify memory allocations caused by garbage collection? A) CPU Usage B) GPU Usage C) Memory D) Rendering Answer: C Explanation: The Memory module displays allocation spikes and GC activity. Question 29. Which of the following is the most efficient way to check if a specific layer is included in a LayerMask named “enemyMask”? A) if (enemyMask == LayerMask.NameToLayer("Enemy")) B) if ((enemyMask.value & (1 << enemyLayer)) != 0) C) if (enemyMask.Contains(enemyLayer)) D) if (enemyMask & enemyLayer) Answer: B Explanation: Bitwise AND with the shifted layer bit determines inclusion efficiently. Question 30. Which Unity API call would you use to pause the entire game’s time scale? A) Time.timeScale = 0f; B) Time.Pause(); C) Time.StopAllCoroutines(); D) Application.Pause(); Answer: A Explanation: Setting Time.timeScale to zero stops time-based updates, effectively pausing the game.
Explanation: C# allows default parameter values using the “= value” syntax in the method signature. **Question 34. When using a NavMeshAgent, which function allows you to set the current destination while preserving the current path’s smoothness? ** A) SetDestination(Vector3) B) Warp(Vector3) C) SetPath(Path) D) Stop() Answer: A Explanation: SetDestination tells the agent to calculate a new path to the target while keeping movement smooth. Question 35. Which of the following is true about Time.deltaTime? A) It is constant throughout the game. B) It represents the time since the last FixedUpdate. C) It varies each frame and should be used to make movement frame-rate independent. D) It can be negative. Answer: C Explanation: deltaTime reflects the elapsed time between frames, enabling frame-rate independent calculations. Question 36. What does the Unity attribute [ContextMenu("Reset Health")] enable? A) Adds a right-click menu option in the Inspector to invoke the method. B) Calls the method automatically when the game starts.
C) Makes the method public to other scripts. D) Registers the method as a global shortcut. Answer: A Explanation: ContextMenu adds a custom entry to the component’s context menu in the Inspector. **Question 37. Which of the following is the most appropriate way to store a large amount of read-only data that should not be duplicated across scenes? ** A) Static variables in a MonoBehaviour B) ScriptableObject placed in Resources C) PlayerPrefs D) Prefab with a MonoBehaviour field Answer: B Explanation: ScriptableObjects can be loaded once and shared across scenes without duplication. Question 38. In Unity’s UI system, which component defines how UI elements are arranged in a grid? A) HorizontalLayoutGroup B) VerticalLayoutGroup C) GridLayoutGroup D) ContentSizeFitter Answer: C Explanation: GridLayoutGroup automatically positions child UI elements in rows and columns.
Explanation: LateUpdate is called after Update, making it ideal for adjusting objects based on other objects’ final positions. Question 42. In Unity’s 2D physics, which component is equivalent to a 3D Rigidbody? A) Rigidbody2D B) BoxCollider2D C) Physics2D D) Collider2D Answer: A Explanation: Rigidbody2D provides mass, velocity, and physics simulation for 2D objects. Question 43. Which of the following is true about the Resources.LoadAll() method? A) It loads assets synchronously from the StreamingAssets folder. B) It loads every asset of type T from the entire Resources folder hierarchy. C) It only works for textures. D) It returns a single asset, not an array. Answer: B Explanation: LoadAll() returns an array of all assets of type T found under Resources. Question 44. When using the new Input System, what is the purpose of an Input Action’s “Interaction” property? A) To define how the input value is transformed (e.g., press, hold). B) To map the action to a specific keycode. C) To set the action’s priority.
D) To bind the action to a UI button automatically. Answer: A Explanation: Interactions specify behavior such as “Tap”, “Hold”, or “Press” for an action. Question 45. Which of the following best explains why using “GameObject.Find” inside Update is discouraged? A) It only works in the editor. B) It performs a costly scene-wide search each frame, harming performance. C) It returns null for inactive objects. D) It cannot find objects with the tag “Player”. Answer: B Explanation: Frequent use of GameObject.Find creates unnecessary overhead; caching references is preferred. Question 46. Which attribute would you use to hide a public field from the Inspector? A) [HideInInspector] B) [NonSerialized] C) [SerializeField] D) [Obsolete] Answer: A Explanation: HideInInspector prevents a public field from being displayed in the Inspector. Question 47. In Unity’s Particle System, which module controls the lifetime of individual particles? A) Emission
Question 50. What is the purpose of the “[ExecuteInEditMode]” attribute on a MonoBehaviour? A) To allow the script to run its Update, OnEnable, etc., while the editor is not in Play mode. B) To make the script run only in builds, not in the editor. C) To disable the script when the game is paused. D) To force the script to compile in edit mode. Answer: A Explanation: ExecuteInEditMode enables MonoBehaviour callbacks to run in the editor outside of Play mode. Question 51. Which of the following best describes the function of a “Canvas Scaler” with UI Scale Mode set to “Scale With Screen Size”? A) It changes the canvas resolution to match the screen. B) It adjusts UI element sizes based on the reference resolution and screen dimensions. C) It disables pixel-perfect rendering. D) It forces all UI to appear at a fixed size regardless of resolution. Answer: B Explanation: Scale With Screen Size scales UI proportionally using a reference resolution. Question 52. In Unity, which method is invoked when a networked object is destroyed on the server and needs to be removed on clients using UNet (deprecated) or Mirror? A) OnDestroy B) OnNetworkDestroy C) OnServerDestroy D) OnDisable
Answer: B Explanation: OnNetworkDestroy (or its equivalent in Mirror) is called to clean up networked objects across clients. Question 53. Which of the following is the correct way to declare a generic method that swaps two variables of the same type? A) void Swap(ref T a, ref T b) {} B) void Swap(T a, T b) {} C) void Swap(ref T a, ref T b) {} D) void Swap(out T a, out T b) {} Answer: A Explanation: Using “ref” with a generic type allows the method to modify the original variables. Question 54. Which Unity component would you add to a GameObject to enable it to be rendered by a specific Camera only? A) LayerMask B) CameraCullMask C) Camera component D) Renderer’s “Additional Camera” field (via script) Answer: B Explanation: By placing the object on a layer excluded from the Camera’s culling mask, you control its visibility per camera. Question 55. Which of the following statements about the “static” keyword in C# is true within Unity scripts? A) Static fields are serialized and shown in the Inspector. B) Static methods can be called without an instance of the class.