Unity Practice Test 1 — Questions and Answers
Question 1: Complete the sentence: During the lifespan of a Unity script, Start is called _________________ .
- multiple times
- exactly once (Correct answer)
- twice
Correct answer: exactly once
In Unity, the `Start()` method is a lifecycle callback that is invoked exactly once during the lifetime of a script. It is called just before the first frame update, after the `Awake()` method and after the script instance has been enabled. This makes it a suitable place for initialization logic that might depend on other objects being initialized.
Question 2: Check the statement - Awake is only called in a Unity script if the script isn't activated.
- A) The statement is invalid (Correct answer)
- B) The statement is valid
Correct answer: A) The statement is invalid
The statement is invalid because the `Awake()` method in Unity is called when a script instance is being loaded, regardless of whether the script is enabled or not. It is executed before the `Start()` method and is typically used for initializing variables or game state before the game starts. Therefore, `Awake()` will always be called if the script is present and loaded.
Question 3: In Unity, which view may display a 3D or 2D perspective?
- The Render View
- The Game view
- The Scene view (Correct answer)
- The Final view
Correct answer: The Scene view
The Scene view in Unity is the interactive window where you visually navigate, manipulate, and assemble your game world. It allows developers to see and edit GameObjects from either a 3D or 2D perspective, depending on the project settings and the current view mode. This flexibility makes it central to level design and object placement.
Question 4: Select the location of the Unity Collaborate button on the Unity editor window interface.
- The Hierarchy window
- The Toolbar (Correct answer)
- The Project window
- The Inspector Window
Correct answer: The Toolbar
The Unity editor's Toolbar is located at the top of the interface and contains various essential controls, including play/pause/stop buttons, transform tools, and collaboration features. The Unity Collaborate button, which facilitates team-based development and version control, is prominently placed within this Toolbar for easy access.
Question 5: After exiting (True/ False), adjustments done in inspector during play mode are permanent.
- A) False (Correct answer)
- B) True
Correct answer: A) False
In Unity, any adjustments made to GameObjects or components in the Inspector window while in Play Mode are temporary. These changes are automatically reset to their pre-Play Mode values once you exit Play Mode. This feature allows developers to test changes and iterate quickly without permanently altering their scene setup.
Question 6: True/ False: The following steps are used to create a NavMesh from level geometry tagged as Navigation Static: Baking
- A) True (Correct answer)
- B) False
Correct answer: A) True
To create a NavMesh in Unity, you first tag the relevant level geometry (e.g., floors, platforms) as 'Navigation Static' to indicate it should be considered for navigation. Then, you use the 'Bake' process within the Navigation window to generate the NavMesh, which agents can subsequently use for pathfinding. This process computes the walkable surfaces.
Question 7: True or False: This animation window view allows the keys of several objects to be displayed on horizontal tracks: Dope Sheet
- A) False
- B) True (Correct answer)
Correct answer: B) True
The Dope Sheet view in Unity's Animation window is designed to display the keys of multiple animated properties and objects on horizontal tracks. This view provides a chronological overview of keyframes, allowing animators to easily adjust timing and synchronize animations across different elements. It's excellent for managing the overall timing of complex animations.
Question 8: True or False: This determines the air resistance from forces influencing the GameObject in a Rigidbody component.: Drag
- A) False
- B) True (Correct answer)
Correct answer: B) True
In Unity, the `Drag` property of a Rigidbody component determines the air resistance or fluid friction applied to a GameObject when it moves. A higher drag value will cause the object to slow down more quickly when influenced by forces, simulating resistance from the environment. This property is crucial for realistic physics simulations.
Question 9: True or False: To make this animation placeholder in the Animator Window, first right-click in any available spot. Is it time for you to make a decision? Create State>Empty
- A) False
- B) True (Correct answer)
Correct answer: B) True
To create a new animation state placeholder in the Unity Animator Window, you typically right-click in an empty area of the graph. From the context menu that appears, you then select 'Create State' and choose 'Empty' to add a new, unconfigured state to your Animator Controller. This allows you to define new animation behaviors.
Question 10: True or False: In the Unity Editor, a Prefab is: Collisions with other Nav Mesh Agents and geometry are avoided.
- A) False (Correct answer)
- B) True
Correct answer: A) False
A Prefab in Unity is a reusable GameObject asset that allows you to store and instantiate complex objects with their components and properties. It serves as a template for GameObjects, not a component that avoids collisions with Nav Mesh Agents. Collision avoidance for Nav Mesh Agents is handled by the NavMesh Agent component itself and the NavMesh system.
Question 11: The Unity Editor is in this mode, which is indicated by the red play controls:
- A scene starts
- Area Light
- Animation Record (Correct answer)
- Game Mechanics
Correct answer: Animation Record
When the Unity Editor's play controls (play, pause, stop) turn red, it indicates that the editor is in Animation Record mode. In this mode, any changes made to a GameObject's properties will automatically create keyframes in the Animation window, allowing you to easily record animations by simply manipulating objects in the Scene view.
Question 12: Your project must be synced to _________________ in order to use Unity Cloud Build.
- A source control repository (Correct answer)
- Animation Record
- Color Over Lifetime
- Animator Component
Correct answer: A source control repository
Unity Cloud Build is a service that automates the build process for your Unity projects, compiling them for various platforms. To use it, your project files must be stored in a supported source control repository (like Git, SVN, or Perforce) so that Cloud Build can access the latest code for compilation. This ensures version control and collaborative development.
Question 13: Complete the following code to refer to the position of the gameObjects: Vector3 pos = ???
- A source control repository
- Color Over Lifetime
- transform.position (Correct answer)
- Project ID
Correct answer: transform.position
In Unity, every GameObject has a `Transform` component, which stores its position, rotation, and scale in the world. To refer to the position of the GameObject a script is attached to, you use `transform.position`. This property returns a `Vector3` representing the GameObject's current world coordinates, making it essential for movement and positioning.
Question 14: When you click this button, what method gets called?
- Hierarchy Window
- Curve Editor
- AudioSource.Play (Correct answer)
- Computer-controlled
Correct answer: AudioSource.Play
While the question is somewhat generic, in the context of Unity and audio, the most common method called to initiate playback of an audio clip attached to an `AudioSource` component is `AudioSource.Play()`. This method starts playing the audio clip assigned to that specific AudioSource. Other methods like `PlayOneShot` or `PlayDelayed` also exist for specific scenarios.
Question 15: Score accumulation, attacking, and player health are some examples of _________________:
- GetComponent
- Animation Record
- Label and Type
- Game Mechanics (Correct answer)
Correct answer: Game Mechanics
Game mechanics are the rules, systems, and interactions that define how a player interacts with a game and how the game responds. Examples like score accumulation, attacking, and player health are fundamental elements that govern gameplay and player experience. They are the core components that make a game function and engage players.
Question 16: The material property is a map that makes polygons appear to have more surface detail than they actually have.
- Drag
- Normal (Correct answer)
- Soft
- Smoothness
Correct answer: Normal
A normal map is a type of texture map used in 3D rendering to add surface detail, such as bumps and grooves, to a low-polygon model without increasing its geometric complexity. It stores directional information (normals) that tell the renderer how light should interact with the surface, creating the illusion of intricate detail and enhancing visual realism.
Question 17: Distinguish between Rewarded and Simple Ads:
- avoid collisions with other Nav Mesh Agents and geometry
- Rewarded Ads cannot be skipped be default (Correct answer)
- Circle, Edge, Box, and Cone are examples of:
- Animation Clips
Correct answer: Rewarded Ads cannot be skipped be default
The primary distinction between Simple (or Interstitial) Ads and Rewarded Ads in mobile advertising is that Rewarded Ads offer an in-game incentive to the user for watching them, and they are typically non-skippable by default. Simple Ads, on the other hand, are often skippable after a short period and don't usually offer a direct reward, making them less engaging for users.
Question 18: This type of image must be imported for an Image Component:
- Sprite (Correct answer)
- float
- Trigger
- Emitter
Correct answer: Sprite
In Unity's UI system, an `Image` Component is used to display 2D graphics on a Canvas. The type of image asset that must be imported and assigned to an `Image` Component is a `Sprite`. Sprites are 2D graphics optimized for use in games and UI, allowing for efficient rendering and manipulation within the Unity editor.
Question 19: The animation window's graph view displays animations:
- Spot light
- Curve Editor (Correct answer)
- The Sprite Editor
- Canvas Scaler
Correct answer: Curve Editor
The Animation window in Unity offers different views for editing animations. The Curve Editor view displays animation data as curves, allowing for precise control over the interpolation and easing of animated properties. This graphical representation is ideal for fine-tuning the motion and timing of animations, providing granular control over movement.
Question 20: Which of the emit from options allows particles to come from any point within the emitter geometry?
- Dope Sheet
- float
- Volume (Correct answer)
- Image
Correct answer: Volume
In Unity's Particle System, the 'Shape' module determines where particles are emitted from. When the 'Emit from' option is set to 'Volume,' particles will originate from any point within the defined 3D shape (e.g., a sphere, box, or cone). This creates a volumetric emission effect, allowing particles to fill a space rather than just emitting from a surface or edge.
Question 21: A Culling Mask on a Light Component
- Determines which layers are affected by the light (Correct answer)
- Drop from the Project window onto the GameObject in the Inspector
- Arrange and maintain a set of animations for a GameObject
- The current placement of objects in the scene and hierarchy
Correct answer: Determines which layers are affected by the light
The `Culling Mask` property on a Light Component in Unity allows you to specify which rendering layers the light will illuminate. By selecting or deselecting layers in the mask, you can control precisely which GameObjects in your scene are affected by that particular light source. This enables selective lighting, allowing for complex and optimized lighting setups.
Question 22: Which component allows the canvas to resize in response to the size of the display?
- Canvas Scaler (Correct answer)
- Hierarchy Window
- AudioSource.Play
- Animation Record
Correct answer: Canvas Scaler
The `Canvas Scaler` component in Unity's UI system is crucial for ensuring that UI elements scale appropriately across different screen resolutions and aspect ratios. It allows the canvas to resize and adapt its elements in response to the display size, maintaining a consistent look and feel regardless of the device. This is essential for responsive UI design.
Question 23: Which of the following methods does not return a value?
- A scene starts
- GetComponent
- void Start() (Correct answer)
- AudioSource.Play
Correct answer: void Start()
In programming, a `void` return type indicates that a method does not return any value. In Unity, lifecycle methods like `Start()` and `Awake()` are declared with `void` because they are callbacks invoked by the engine and are not expected to return data to the caller. Their purpose is to execute code, not to produce a value.
Question 24: A spherical light that radiates in every direction
- Point Light (Correct answer)
- Area Light
- Spot light
- Brightness
Correct answer: Point Light
A Point Light in Unity simulates a light source that emits light uniformly in all directions from a single point in space. This perfectly matches the description of a "spherical light that radiates in every direction," making it ideal for effects like a bare light bulb or a magical orb.
Question 25: Lightmaps store data in which type of file?
- Dope Sheet
- Sub-emitter
- EXR (Correct answer)
Correct answer: EXR
Unity's lightmaps, which store pre-calculated lighting information for static objects, are typically saved as EXR (OpenEXR) files. EXR is a high dynamic range (HDR) image file format, allowing lightmaps to store a wide range of light intensities and accurate color data, crucial for realistic lighting.
Complete the sentence: During the lifespan of a Unity script, Start is called _________________ .