Chapter 14: Full Unity Programmer Mock Exam

Welcome to the Full Unity Programmer Mock Exam. Here, we will provide a series of multiple-choice questions, similar to the ones you have been answering at the end of every few chapters in this book.

Try your best and see how it goes – the idea is to get all of the questions right. If and when you complete this mock exam, you will be ready to go ahead with the real Unity Programmer exam. If, for any reason, you get a question wrong, go back through this book or Google to try and find the answer. Try to avoid skipping to the answer in the Appendix; use your knowledge more than muscle memory. It's important you understand the question so that you can answer it. These mock questions are only examples of the kinds of questions you will get in the exam.

I recommend reading every question at least twice; sometimes, exam questions will try to catch you out through how the questions are worded. The exam will also try and take your time away by making you read a long piece of code, which isn't really required.

The exam is timed, but you should have enough time to answer each multiple-choice question. It's probably best to keep some personal time aside for when you start and finish this mock exam. If you are struggling with a question, skip it and come back to it later. Sometimes, it's easier to do the exam questions in sweeps to get the easier ones out of the way. If you are still struggling, I have marked, in brackets at the end of each question, the chapter/Appendix you can get more information from.

So, take your time, don't get caught out with the wording, and proceed... If you enjoy it, that's also a bonus!

Full mock exam

  1. One of your junior programmers has asked for a global instance with a class that can be accessed anywhere in the code of the game. What design pattern would fulfill this requirement when you could have code that acts as a manager? (CH1)
    1. Prototype
    2. Abstract Factory
    3. Singleton
    4. Builder
  2. You have been asked by your head of development to make it so whenever a player walks through a doorway, a light next to the door will turn on. You have made an OnTriggerEnter() script that enables a light and added a collider to your doorway with a Rigidbody. Your player has a collider and Rigidbody as well. When you run the game to test your code, the light doesn't turn on.

What is most likely the cause of this issue? (CH2)

  1. The doorway's collider is not marked as a trigger.
  2. The light game object needs a trigger as well.
  3. You don't need multiple Rigidbody components.
  4. The doorway isn't connected up to the light.
  1. What function allows us to take a Vector3 or Vector2 reading from any direction but keep its magnitude to just one? (CH7)
    1. Normalize()
    2. MoveTowards()
    3. Lerp()
    4. Scale()
  2. We have been given our Game Design Document (GDD) and in it, it states that our Player Character (PC) will need to run and dodge multiple beach balls that are thrown at them. The beach balls can bounce off each other. Also in the scene are various static props and a trigger area for the PC to grab health.

Which objects in this scene would at least need a Rigidbody component? (CH2)

  1. The PC and the beach balls
  2. The PC and the invisible health area
  3. The beach balls only
  4. The beach balls and the invisible health area
  1. Relating to the beach ball question, in the Layer Collision Matrix (Edit | Project Settings | Physics) of our project, which of our collider's physics in the matrix should be checked when it comes to them interacting with each other? (CH13)
    1. PC and beach ball, beach ball and beach ball, and PC and health area
    2. PC and beach ball
    3. Beach ball and health area, beach ball and beach ball
    4. PC and health area
  2. We have a mobile app that will need to support low-performing tablets. In our app, we will have a mini-game where the player will be able to throw an unlimited supply of basketballs into a hoop. However, only 10 basketballs are in the view of the camera. Due to this, the programmer has made it so that the same 10 basketballs will be used instead of instantiating a new basketball on each throw.

The programmer is aware that the design pattern for reusing the basketball assets has a name. What is this design pattern's name? (CH1)

  1. Abstract Factory
  2. Object Pool
  3. Dependency Injection
  4. Builder
  1. You have been assigned to make an application that plays music as the application starts. As the user goes through different scenes, the music will not be removed or affected and continue to play. You've made a start by creating a game object and added a script to it that plays the music.

What else do we need to do to make sure our music continues to play? (CH3)

  1. Create two game objects that contain both music scripts on the starting scene only.
  2. Each scene needs a music game object with a script.
  3. Add DontDestroyOnLoad(this.gameObject); to the Awake function in the music script.
  4. Instantiate the music game object on every scene.
  1. In Unity's Cloud Build, what should we check to find the latest build? (CH1)
    1. cloudBuildTargetName
    2. buildNumber
    3. bundleID
    4. scmCommitID
  2. We have a mobile game that is gesture-controlled, and we want to make it so we swipe the screen from one side to the other to release an event.

What's the best way of measuring our player's finger press location from and to the Touch struct? (CH13)

  1. Type
  2. Phase
  3. deltaPosition
  4. fingerId
  1. Our head programmer is trying to find an easy way for our Flight Simulator game to cover controls for mobile, PC, and console.

What's the easiest way of achieving this? (CH13)

  1. Make a Unity project that supports each game.
  2. Have a class for each platform.
  3. Import the CrossPlatformInput package from Standard Assets.
  4. Use #define directives for each possible platform to create a custom input manager.
  1. In our flight simulator, we have just hooked up our horizontal and vertical controls with Input.GetAxis("Horizontal") and Input.GetAxis("Vertical"). The game designer has pointed out the controls are sluggish and we need the movements to be more responsive. (CH2)

What settings do we need to alter in the Input Manager to improve/amend this?

  1. Invert
  2. Sensitivity
  3. Axis
  4. Gravity
  1. We are now making a side-scrolling platform game and we want it so that when we press the A button, we jump, but we also want it so that if we press the up arrow key, we also jump. In the Input Manager, where do we add the second button to jump? (CH2)
    1. Alt Positive Button
    2. Alt Negative Button
    3. Negative Button
    4. Positive Button
  2. With our platform game, we have noticed the player will run left and right fine, but when I put the gamepad down, my player's character is slowly moving right. I believe I need to change a setting in the Input Manager, but which one? (CH2)
    1. Sensitivity
    2. Snap
    3. Gravity
    4. Dead
  3. Typically, when typing names of instance variables, what naming convention do we use? (CH2)
    1. Positional notation
    2. All caps
    3. Snake case
    4. Camel case
  4. A bug fix has been issued to you where game designers have been altering a public int variable and making it too high in the Unity Editor. There is no reason for the variable to go over 100.

What attribute should the programmer use to restrict the game designer? (CH2)

  1. [GUITarget]
  2. [TextArea]
  3. [Range]
  4. [Header]
  1. You have been assigned a task from your technical lead to store the 800 non-player character (NPC) prefabs. Either one of these prefabs can be picked and dropped into the game to roam around. This system needs to be user-friendly for our designers and ideally, all selections of NPCs should come from the Inspector window. There is also a chance the number of enemies will increase from the original 800.

How will you prepare to issue these NPCs? (CH2)

  1. Simply create a script to store a public array that will accommodate the creation of each prefab.
  2. Create a Scriptable Object containing an array of referenced prefabs.
  3. Make a class containing a private serialize field list of NPC prefabs and have each class of the NPC create an instance of an NPC at runtime.
  4. Create all 800+ NPCs at runtime and store them out of the camera view.
  1. What setting do we change in Time Manager if we want Unity to calculate its physics at a certain time in an update? (CH10)
    1. Maximum Allowed Timestep
    2. Fixed Timestep
    3. Maximum Allowed Particle Timestep
    4. Time Scale
  2. Which collider is the most efficient? (CH2)
    1. Capsule
    2. Sphere
    3. Mesh
    4. Box
  3. We are simulating a boulder falling through the sky, as well as a packet of crisps. We want the boulder to fall faster.

What settings do we change in either of our game objects' Rigidbody components? (CH13)

  1. Decrease the packet of crisps' Mass and increase the boulder's Drag.
  2. Increase the packet of crisps' Angular Drag and increase the boulder's Mass.
  3. Increase the boulder's Mass and decrease the packet of crisps' Mass.
  4. Decrease the boulder's Drag and increase the packet of crisps' Drag.
  1. When would we use a trigger instead of just a collider? (CH2)
    1. When a character is sitting in a health zone charging their energy.
    2. If two game objects collide but we only want to set our particle effects manually.
    3. Only if we need to alter our Rigidbody settings during runtime.
    4. Whenever multiple colliders are children of another collider.
  2. You are making a sci-fi arcade shooter game. The gamer's view has a UI display wrapped around the screen with lots of vital details about our mission and our ship's health. In the lower corner of the screen, we have a 3D view of the condition of our ship. Whenever the ship takes damage, we can see the results in our 3D view, along with particle effects to emphasize the damage. Each possible damage point on the ship in the 3D view has a collider that reacts if a missile hits it.

In testing, you realize the ship in the 3D view has enemy missiles bouncing off your colliders when they're supposed to be damaging your ship.

How should the programmer solve this issue while retaining the functionality of both the in-game objects and the UI? (CH13)

  1. In the Layer Collision Matrix, turn off collisions between the 3D UI ship layer and the missile and asteroid layers.
  2. Increase the Mass of the missiles to get through the collider.
  3. Add a second collider to all the colliders on the ship to increase its probability.
  4. Add one main collider to go around the ship so that when a missile hits it, this will disable all the colliders inside for a split second.
  1. You have moved studios and jumped on a new game project where you are in a desert defending a fort from 6,000 donkeys charging to destroy your civilization. Your only line of defense is throwing heavy wet bean bags to tire the donkeys out. To target each donkey, you use a raycast system that makes contact with the mesh collider on either donkey. Your head of development has now requested 20,000 donkeys to up the ante. You are now starting to notice the performance of the game has drastically dropped. Everyone on the team is making an effort so that all 20,000 donkeys are in the game.

What changes can you make to improve the game's performance? (CH2)

  1. Make the donkeys slightly bigger so more space is taken up in the environment.
  2. Replace the mesh colliders with sphere colliders.
  3. Create a special donkey layer mask so the rest of the environment is ignored.
  4. Shorten your raycast's length.
  5. Never go full donkey.
  1. A member of your team has pushed a commit for a new segment to your game. At this stage, it's recommended to make sure the entirety of your game runs OK.

Your head of development has requested that you test your game. Which test should you perform? (CH13)

  1. Smoke
  2. Integration
  3. Regression
  4. System
  1. You have been asked to check specific parts of someone else's code by creating custom methods to make sure the return value is what it should be.

There is a name for the specific type of test you are performing. What is it? (CH13)

  1. Static test
  2. Accessibility test
  3. Unit test
  4. Backend test
  1. What are some of the benefits of a unit test? (CH13)
    1. It will check the entirety of your code.
    2. It tests a single "unit" of code.
    3. If performed regularly, it only requires the latest code to be tested.
    4. Unit tests expose how efficient your code is between functions.
  2. When using a MinMaxCurve, which property is the least expensive in terms of performance? (CH4)
    1. Optimized curve
    2. Random between two constants
    3. Random between two curves
    4. Constant
  3. Which of the following will prevent a particle system from supporting Procedural Mode? (CH4)
    1. Disable looping.
    2. Set the Simulation Space property to World.
    3. Uncheck the Auto Random Seed tick box.
    4. Enable Collision.
  4. An artist has approached you, requesting you to make a visual change to the sci-fi game you are currently working on. He has requested you to shrink a series of asteroids over time as they hurtle closer to a planet.

The asteroids come from a particle system emitter; which module would suit the requirement of the artist? (CH4)

  1. Renderer
  2. Texture Sheet Animation
  3. Sub Emitters
  4. Size Over Lifetime
  1. The whole development team has nearly finished creating their "Spitfire Battle of Britain" game and wants to add particle effects to the back of each Spitfire plane as a final touch.

One of the game designers has suggested smoke coming out of the back of the Spitfire should change randomly to emphasize the choppiness of the wind. You have programmed to the point where the particle effect is detecting wind, but what should you do to the particle smoke to show that the wind is affecting the smoke? (CH13)

  1. Change the Angular Velocity property in the Rotation by Speed module.
  2. Set the Multiplier property in the External Forces module to 0.
  3. Increase the Strength property in the Noise module.
  4. Alter the curve of the Size property in the Size by Speed module.
  1. In the indie game you are developing, you have set your scene up so that the Environment Lighting Intensity Multiplier is set to an intensity of 0.75. When your player completes the level and moves on to the next scene, the lighting is set at 1.24. You are using LoadSceneAsync with a LoadSceneMode of additive.

When you load up the next scene, what will the light intensity be set to? (CH3)

  1. 1.24
  2. 0.75
  3. 1
  4. 0
  1. You have moved studios yet again and started working on a massive open-world game where your player can walk for miles and miles. Because of the complications of scenes being potentially too big, you have decided to break your scenes up into multiple segments. When it comes to a scene change, your player will be loaded through into the next scene.

What function allows us to make a game object move over into another scene? (CH3)

  1. CreateScene()
  2. MoveGameObjectToScene()
  3. MergeScenes()
  4. SetActiveScene()
  1. When it comes to storing data, which is the more likely choice for PlayerPrefs? (CH11)
    1. Purchase information
    2. Monitor resolution settings
    3. User email address
    4. Login passwords
  2. Which type of variable can you save without emulating (natively) in PlayerPrefs? (CH11)
    1. Float
    2. Double
    3. Enum
    4. Array
  3. Which system namespace would you use when serializing data to the device's local disk space? (CH11)
    1. Linq
    2. IO
    3. Data
    4. Collections
  4. At the end of our sci-fi game, we save all of our stats in JSON format from our PlayerStats class to local disk space. But when we want to retrieve the JSON file from our storage, what do we replace the missing gap with? (CH11)

JsonUtility.FromJson<____>(stringFromFile);

  1. StatsInfo
  2. String
  3. Array
  4. PlayerStats
  1. When retrieving an image from the internet, which UI component do we use to display the result? (CH9)
    1. Canvas
    2. Raw Image
    3. Image
    4. Panel
  2. Which UI component stores a series of UI elements in a row at a fixed distance? (CH9)
    1. Vertical Layout Group
    2. Horizontal Layout Group
    3. Grid Layout Group
    4. Canvas Group
  3. We have made it possible for our game to update several statistics from the Remote Settings section in the Unity Dashboard.

Which of the following values are we allowed to use? (CH11)

  1. Char
  2. string
  3. List
  4. UInt16
  1. Which of these platforms can Unity Analytics be used for? (CH11)
    1. PS4
    2. Commodore Amiga 500
    3. Android
    4. Xbox
  2. As soon as you connect your game to Unity Analytics, which event will automatically start giving you daily reports? (CH11)
    1. Core Events
    2. Standard Events
    3. Custom Events
    4. Transaction Events
  3. In our First-Person Shooter (FPS) game, we have just hooked up our marine's space cannon's Finite State Machine so that it fires the projectile.

When the cannon is fired, there is a banging sound, particle effects fountain out from the cannon, and a beam fires outward.

Currently, the only thing the beam can come into contact with is a wall, which has a collider attached to it.

When the beam hits the wall, there is another particle that is triggered when the impact of the surface hits. During this explosion, we shrink and then destroy the beam.

Which event should we expect the beam to be destroyed in? (CH4)

  1. OnStateExit
  2. OnStateEnter
  3. OnStateMove
  4. OnStateUpdate
  1. You are prototyping a third-person character for a SWAT team game, and we are going to need to get some fundamental controls up and running. Our character is currently set to run, lean, and shoot in all directions. Ideally, we want it so our character can shoot and jump, or shoot and lean. Currently, our Base Movement is set to Override Blending, while the other layers are set to Additive Blending.

In which order should the Animation Layers be set? (CH4)

  1. Shoot, Lean, Base Movement
  2. Base Movement, Shoot, Lean
  3. Lean, Base Movement, Shoot
  4. Shoot, Base Movement, Lean
  1. We have an animation from a player that goes from standing to crouching. We want the animation between each animation to take exactly 0.8 seconds.

What properties do we need to focus on in the Animation transition? (CH4)

  1. Transition Duration and Transition Offset
  2. Fixed Duration and Transition Duration
  3. Has Exit Time and Fixed Duration
  4. Has Exit Time and Exit Time
  1. When it comes to animating a face in Unity, which is the best blend tree to use? (CH4)
    1. 2D Freeform Cartesian
    2. Direct
    3. 2D Simple Directional
    4. 1D
  2. In your latest indie game development, you have been focusing on the Animation Controller's transitions. The order of your transitions goes as follows:
    1. Idle to Cry
    2. Idle to Skip
    3. Idle to Sneeze
    4. Idle to Laugh

Your animation transition properties are set to the following:

  • Interruption Source: Current State
  • Ordered Interruption: Ticked

Your current transition is set to Skip. At runtime, your character has begun to Skip, but as a tester, you also press all four buttons to trigger each of the animation states.

Which of the transitions will take priority? (CH4)

  1. Idle to Laugh
  2. Idle to Sneeze
  3. Idle to Cry
  4. Idle to Skip
  1. You are creating a First Person Shooter (FPS) and you are currently working on the player's camera and making sure their weapon doesn't clip through objects when you get too close.

All of the player's weapons are set to a layer called FPS. You then set your camera's Culling Mask in order to view everything apart from the FPS layer.

Next, you create a second camera and set its Culling Mask to only render the FPS layer and its Clear Flags to what? (CH9)

  1. Depth Only
  2. Solid Color
  3. Don't Clear
  4. Skybox
  1. Being an enthusiastic indie developer, you have decided to make a spiritual successor to the game "Desert Bus." You have nearly finished developing the game and decided to add some optimizations. You have decided to make it so that any of the smaller 3D assets such as pebbles, small plants, and insects should not be rendered at a far distance, only when close up. We should still be able to see larger assets, no matter what distance we are from them.

Which camera property would you use to help achieve this? (CH2)

  1. farClipPlane
  2. layerCullDistances
  3. cullingMatrix
  4. useOcclusionCulling
  1. When writing a custom toon-shaded edge detection effect script, what should the camera's DepthTextureMode be set to? (Appendix)
    1. None
    2. DepthNormals
    3. MotionVectors
    4. Depth
  2. We are currently developing a game where our player sees through Unity's main camera and has the capability to temporarily zoom in.

What property of our camera allows us to zoom in? (CH2)

  1. targetDisplay
  2. aspect
  3. lensShift
  4. fieldOfView
  1. You have introduced a multiplayer split-screen mode to your game. You are now dividing the screen into two rows.

How should the programmer set the Viewport Rect options on the cameras? (CH2)

  1. Set both cameras' W to 1 and H to 0.5. Set Player 1's Y to 0.5 and Player 2's Y to 0.
  2. Set both cameras' W to 1. Set Player 1's H to 0.5 and Player 2's H to 1. Set both cameras' Y to 0.5.
  3. Set both cameras' W to 0.5 and H to 1. Set Player 1's Y to 1 and Player 2's Y to 0.5.
  4. Set both cameras' W to 1 and H to 0.5. Set Player 1's Y to 1 and Player 2's Y to 0.5.
  1. Our game has had some conflicts, so as a precaution we need to tighten security. Below is a sample of code:

    public class SuperFox : MonoBehaviour

         {

              public float superAttack = 1f;

              public float superFly = 5f;    

         }

What's the best way to keep these two variables safe? No other classes use them, but we need access to them from the Inspector for the Game Designer.

  1. Change access modifiers from public to private.
  2. Change access modifiers from public to private and add the [SerializeField] attribute.
  3. Change access modifiers to private and give them get and set accessors
  4. public on it's own is safe enough; it's only a couple of floats
  1. We have a physics-based object that we want to rotate around a particular point such as a door.

Which type of joint will allow this type of movement? (CH2)

  1. Character
  2. Fixed
  3. Hinge
  4. Spring
  1. We have been given a lamp asset from an artist and they have asked us to make it so the lamp's light flickers in the game.

Which property of our light do we need to manipulate in our script to achieve a flickering effect? (CH2)

  1. Mode
  2. spotAngle
  3. range
  4. intensity
  1. You are testing a scene and applying different lights to it. Within the scene, you have a series of game objects:
    • Decorative lights
    • The sun
    • A car with its hazard lights on
    • A garage

The car is parked in the garage. Around the inside of the garage, walls are decorative lights, and the sun is shining through the garage door.

You have enabled Global Illumination to increase the realism of the sun. As impressive as this looks, your scene now takes a high amount of memory usage.

How can we keep our scene looking as impressive but continue to keep the memory usage low? (CH13)

  1. Set Indirect Multiplier to 0 on the sunlight.
  2. Change Light Mode for the lights to Baked.
  3. Set Indirect Multiplier to 0 on the decorative lights, that is, the car's hazard lights.
  4. Disable Realtime Global Illumination in the Lighting settings.
  1. An artist has asked us to change the glow of a neon sign from red to blue with our script.

Which property can we use to alter the glow of our sign? (CH4)

  1. _EmissionColor
  2. _Color
  3. _SrcBlend
  4. _EmissionMap
  1. You have been requested to add a reflective marble effect to a shiny hallway with large, open, white-silver windows. Outside of the building is a bright, sunny background with grass, bushes, and trees all applied to a skybox. The hallway contains a series of reflection probes.

Which Reflection Probe option should be used on the hallway's Mesh Renderer component to create a shiny reflective surface? (CH13)

  1. Simple
  2. Blend Probes and Skybox
  3. Blend Probes
  4. Off
  1. Our hallway floor looks shiny and reflective thanks to the reflection probes. We have also noticed that the walls don't appear to be in sync with the reflective floor.

What setting do we need to change regarding our reflection probe to fix this? (CH13)

  1. Enable Box Projection
  2. Increase Resolution
  3. Increase the Importance
  4. Enable HDR
  1. Your artist has created 3D assets for a snow level and has also attempted to use assets from a previous game. The artist has made a wooden hut and put the asset into the game as well. The overall scene looks great but the overall colors in the scene don't sit with each other.

Which property from our post-processing stack would help make the colors in our scene uniform to give our assets an overall icy look? (CH13)

  1. User LUT
  2. Grain
  3. Chromatic Aberration
  4. Vignette
  1. We have a tech demo where the player walks down a sci-fi corridor, and through the window, the sun shines through and lights up the corridor. We have applied a bloom effect from our post-processing stack. We want some of the game assets in the corridor to shine and glow like what should be expected from a bloom effect. An artist has informed you that all art assets have emission maps, but their levels vary.

Which property do we need to alter to make it so our bloom effects cover the lower-level emission maps? (CH13)

  1. Decrease Threshold
  2. Increase Intensity
  3. Decrease Soft Knee
  4. Increase Radius
  1. What is the function that transitions two materials from one over to another at runtime? (CH9)
    1. SetColor
    2. Lerp
    3. SetFloat
    4. EnableKeyword
  2. We are making a first-person survival horror game. Our player has a flashlight for when they walk around a spooky house. Our designer has requested that the end of the flashlight produces a glass pattern on the surfaces the light projects onto.

What light property will support what the designer is asking for? (CH2)

  1. cullingMask
  2. cookie
  3. spotAngle
  4. type
  1. You have reached the end of development for your PC VR game. You currently have your Camera component's Rendering Path set to Forward.

Which of the following post-processing properties would help lower the risk of nausea when using a VR application? (Appendix)

  1. Depth Of Field
  2. Section Multiplying
  3. Saturation
  4. Antialiasing
  1. When developing a VR game, what level of motion for photon latency should a developer target to trick the player's mind into thinking they're in another place? (Appendix)
    1. 80
    2. 20
    3. 35
    4. 50
  2. We are developing a mobile VR game with art assets that hold single-color materials and unlit shaders. Also, our camera component's Rendering Path is set to Forward.

Which Anti-Aliasing setting would improve the visuals of the game, but likely not impact the performance so that it's in an unplayable state? (Appendix)

  1. 4x Multi Sampling
  2. 8x Multi Sampling
  3. 12x Multi Sampling
  4. Disabled
  1. Which window in the Unity Editor will provide a list of draw calls from our project and will also allow us to step through it frame by frame? (CH13)
    1. Profiler
    2. Frame Debugger
    3. Services
    4. Statistics
  2. We have created a VR game where our player is inside a room with a locked door that will not open. The room contains a window and outside is a field of grass with mountains in the distance.

Everything in the player's scene is 3D modeled and textured, and there is also one-directional light.

When the player walks toward the window, the game begins to lag due to the spike in draw calls.

How can we improve the performance of our game? (Appendix)

  1. Remove the 3D models in the distance and replace them with a rendered skybox.
  2. Disable Generate Mip Maps in the Texture Import Settings for all textures in the distance.
  3. Add lights.
  1. To help combat nausea in VR, what Frames Per Second (FPS) do developers need to aim for with their games? (Appendix)
    1. 90 FPS
    2. 30 FPS
    3. 60 FPS
    4. 75 FPS
  2. In the Frame Debugger window, the developer selects a draw call for the geometry of a game object.

In which window does the object get highlighted? (CH13)

  1. Curve Editor
  2. Project
  3. Hierarchy
  4. Console
  1. A designer wants to change the parameters of your scripting of their game characters and save them locally to disk.

What's the safest and easiest way to give the designer access? (CH11)

  1. Store the data as public variables in a MonoBehaviour.
  2. Save the data in a ScriptableObject.
  3. Save the data in PlayerPrefs.
  4. Create a web service with an API that can be read by the game.
  1. If we are writing a script that depends on a particular component, which attribute do we add? (CH2)
    1. [Include]
    2. [Range]
    3. [SerializeField]
    4. [RequireComponent]
  2. Which method will return a Touch struct? (CH13)
    1. GetKeyDown()
    2. touchSupported
    3. Input()
    4. GetTouch()
  3. With regard to the Input class, what is the difference between GetMouseButtonUp and GetMouseButton? (CH13)
    1. GetMouseButton will return true if the mouse button is held down, while GetMouseButtonUp will only return true once during the frame where the mouse button is released.
    2. GetMouseButton will return an Int indicating which mouse button is being pressed, while GetMouseButtonUp will return true if any mouse button is pressed.
    3. GetMouseButton will return true if a mouse is connected, while GetMouseButtonUp will return true if a mouse button is pressed.
    4. GetMouseButton will return an array containing the available mouse buttons, while GetMouseButtonUp will return an index for the array indicating which mouse button is being pressed.
  4. How can we improve performance with a particle system? (CH4)
    1. Reduce the number and size of the particles to reduce the number of pixels on the screen that need to be alpha blended.
    2. Increase the particle lifetime so that more particles can be reused in memory rather than generating new ones.
    3. Reduce the speed of particles to reduce the number of physics updates that are needed.
    4. Randomize properties between two curves rather than two constants to reduce the number of random numbers that need to be generated.
  5. Which of the following methods would be ideal for a health bar that goes across the top of the screen? (CH8)
    1. Horizontal
    2. Radial90
    3. Radial180
    4. Span
  6. You are developing a third-person game where your player will interact with and talk to other characters. You are currently developing speech boxes that appear above each player's head when they're talking in the 3D world.

Which canvas property would best suit a 3D environment for speech? (CH13)

  1. Screen Space Camera
  2. Pixel Perfect
  3. World Space
  4. Screen Space Overlay
  1. Which would suit the use of an orthographic camera? (CH9)
    1. A first-person player perspective
    2. A map screen that shows an overview of the game world
    3. A 3D space battle
    4. An enemy AI
  2. We are developing a strategy game where all players and NPCs are based outdoors. You need to create a day and night cycle, so in your scene, you have a skybox and a directional light.

How will you achieve this? (CH2)

  1. Rotate the directional light.
  2. Adjust the shadow settings on the directional light.
  3. Update the TimeManager settings.
  4. Switch the skybox.
  1. Which of the following will change a material property for a single object? (CH4)
    1. Renderer.shader
    2. Renderer.instance
    3. Renderer.material
    4. Renderer.sharedMaterial
  2. What's the best method to create a glowing lava lake? (CH4)
    1. Create an emissive texture for the lava and animate the UVs on the material.
    2. Create a screen space shader that applies a lava effect to the desired area.
    3. Add dozens of point lights to areas where the lava is moving.
    4. Create a particle effect to simulate the lava's movement.
  3. Our game has a cutscene and we want it to play the music at a particular volume level.

What is the best way of achieving this? (CH10)

  1. When the game plays the cutscene, switch to a different Audio Mixer Snapshot.
  2. When the cutscene starts, change the volume on the Audio Source playing the music and attach a script component to cut out high frequencies.
  3. When the cutscene starts, apply a Reverb Zone around the play area.
  4. When the cutscene starts, apply changes to the player's stored volume controls in PlayerPrefs.
  1. A VR game for low-performance machines uses a Forward Rendering Path. Which of the following will improve the game's overall visuals with a minor frame drop? (CH13)
    1. Anti Aliasing
    2. Real-Time Reflection Probes
    3. Deferred Rendering
    4. Spotlights
  2. You have developed a mobile app that starts with a UI where the user can configure their experience. Once configured, the app goes into VR mode.

How do we make this app start in non-VR mode to begin with? (Appendix)

  1. Place a Camera in the scene and set its FOV to null.
  2. Change the build platform to PC instead of a VR platform.
  3. Set Time.timeScale to 0 at the start of the game and add a script that searches for VR devices after the first frame is rendered.
  4. Add None to the top of the VR SDK list.
  1. If a VR device is rendering at 90 Hz, how many milliseconds should the latency be below? (Appendix)
    1. 11
    2. 12
    3. 13
    4. 14
  2. You have developed a VR game that is getting reports from your testers stating that the game lags in certain parts. Your camera's Rendering Path is set to Forward. You have decided to not reallocate the memory of the eye texture at runtime to avoid any other performance conflicts.

If a frame rate drop is detected, we can set a property in our XRSetting class to help combat this issue.

Which property is the most effective? (Appendix)

  1. occlusionMaskScale
  2. eyeTextureResolutionScale
  3. renderViewportScale
  4. useOcclusionMesh
  1. You are working on a small personal project that contains several scripts. You open one of the scripts and change its public List to private. You save the script and are now presented with a NullReferenceExeception in the Console window.

Based on the information you have been given, what has caused this error to happen?

  1. private needs to be a capital letter.
  2. The original public List can no longer be accessed from the other scripts.
  3. It's likely a bug and needs reporting.
  4. Something is misspelled.
  1. In the following screenshot, we have a scene that contains separate Image components. The two colored squares are proportioned perfectly:
Figure 14.1 – Screenshot for question 92

Figure 14.1 – Screenshot for question 92

What single component can pad these two image components so perfectly?

  1. Horizontal Layout Group.
  2. It's not possible with a single component.
  3. Zooming into the squares and lining them up manually.
  4. Apply 3D Quads on top of the white background and trace around them with vertex snaps.
  1. We are working on some UI today. We have been asked to make a progress bar that will FILL up, starting from the BOTTOM and move all the way to the top.

What properties appear correct to begin with?

    progressChargeBar = GetComponent<Image>();

    progressChargeBar.fillMethod = Image.FillMethod.Vertical;

    progressChargeBar.fillAmount = 0;

    progressChargeBar.type = Image.Type.Filled;

      progressChargeBar = GetComponent<Image>();

      progressChargeBar.fillMethod = Image.FillMethod.Radial180;

      progressChargeBar.fillAmount = 100;

      progressChargeBar.type = Image.Type.Simple;

        progressChargeBar = GetComponent<Image>();

        progressChargeBar.fillMethod = Image.FillMethod.Horizontal;

        progressChargeBar.fillAmount = 50;

        progressChargeBar.type = Image.Type.Sliced;

          progressChargeBar = GetComponent<Image>();

          progressChargeBar.fillMethod = Image.FillMethod.Vertical;

          progressChargeBar.fillAmount = 0;

          progressChargeBar.type = Image.Type.Tiled;

          1. A colleague has asked for some help with regard to their bus prototype running slowly.

          Here is a sample of the code:

          public class BusRacer : MonoBehaviour

          {

               public int playerCount;

               public Bus smallBus;

               private void Start()

               {

                    CreateAndPlaceBus();

               }

               private void Update()

               {

                    Bus[] buses = FindObjectsOfType<Bus>();

                    foreach (Bus b in buses)

                    {

                         b.Drive();

                    }

               }

               private void CreateAndPlaceBus()

               {

                    for (int i = 0; i < playerCount; i++)

                    {

                         var busDriver =

                         Object.Instantiate(smallBus);

                         busDriver.transform.position =

                         StartingPosition();

                    }

               }

               private Vector3 StartingPosition()

               {

                    //TODO Needs filling with content

                    return Vector3.zero;

               }

          }

          public class Bus : MonoBehaviour

          {

               public void Drive()

               {

                    //TODO drive fast

               }

          }

          Can you see what's causing any performance issues from the preceding code?

          1. Take FindObjectsOfType out of Update and cache it once in Start().
          2. Reduce the count of buses in the game as your primary task.
          3. The code seems fine, so check the assets in the scene (textures, polycount, and so on).
          4. Drive() is empty and is causing a memory leak.
          1. The following script has been assigned to you to be refactored into an "MVC" pattern. If you aren't aware of the Model View Controller pattern, it consists of carving up your project into:
            • Model (Data, in other words, variables)
            • Views (Interface/Detection, in other words, UI)
            • Controllers (Decision/Action, in other words, transform.rotation / transform.position)

          Here is a sample of the code:

          public class DrunkenMaster : MonoBehaviour

          {

               private string talk;

               private float drinkMeter;

               private Vector2 location;

               private float runSpeed;

               private float punchStrength;

               private float kickStrength;

               private float rolyPolySpeed;

               public MeshRenderer mesh;

               public TextMesh label;

               public void Update()

               {

                    //Get Input

                    float kickForce =

                    Input.GetAxis("KickForce");

                    float punchForce =

                    Input.GetAxis("PunchForce");

                    float rolyPolyForce =

                    Input.GetAxis("RolyPolyForce");

                    //set drunk strength

                    punchStrength = Mathf.Clamp(punchStrength -

                    punchForce, 0, 120);

                    kickStrength = Mathf.Clamp(kickStrength +

                    kickForce, -45, 45);

                    rolyPolySpeed = Mathf.Clamp(rolyPolySpeed -

                    rolyPolyForce, -45, 45);

                    //update position and drunken monkey skills

                    transform.position = new Vector3(location.x,

                    drinkMeter, location.y);

                    transform.rotation =

                    Quaternion.Euler(Vector3.forward);

                    transform.Rotate(Vector3.up, punchStrength,

                    Space.Self);

                    transform.Rotate(Vector3.forward,

                    rolyPolySpeed, Space.Self);

                    transform.Rotate(Vector3.right,

                    kickStrength, Space.Self);

                    //apply abuse UI

                    label.text = talk;

               }

          }

          With that said, which part of this code would you recognize to be refactored for the Model?

          1. Variables
          2. Content in the Update function
          3. Label.text = talk
          4. None of the above
          1. We have a game where the scene is set at night, in an alleyway with burning oil barrels surrounded by homeless people keeping their hands warm.

          One of the technical artists has asked a favor from you to change the process of how the fire glows. She has asked to have it so the fire starts off green at the bottom of the fire, blue in the middle, and yellow at the top. However, this is the fifth time the technical artist has asked for a color gradient change!

          Important Note

          To refresh your knowledge of particle modules, check the following link: https://docs.unity3d.com/ScriptReference/ParticleSystem.ColorOverLifetimeModule.html.

          Your changes must be done via script (according to your boss), and not in the Inspector window or any form of drag-and-drop method.

          Pick which option you would use to change the process of colors in the particle system:

          1. Create a Color data type and store the variable from the entire barrel particle system in it as Color burningFlames = flamingBarrel.ColorOverLifeTime.color.
          2. Cache the particle system module that controls the gradients of the particle system's colors as ParticleSystem.ColorOverLifetimeModule flameStored = flamingBarrel.colorOverLifetime;.
          3. Forget the script already! Use prefabs – she can do it herself!
          4. It's all about particle speed that affects the color such as Color burningFlames = flamingBarrel.colorBySpeed.color;.
          1. There is code that is written for water that is drunk over time. Our Coroutine is checking until no water is left.

          Here is a sample of the code:

               public float waterMeasurements = 10f;

               private void Start()

               {

                    StartCoroutine(CheckWaterDrank());

               }

               private void Update()

               {

                    //Drinking Water

                    waterMeasurements -= Time.deltaTime;

               }

               IEnumerator CheckWaterDrank()

               {

                    bool AnyWaterLeft()

                    {

                         return waterMeasurements <= 0;

                    }

                    //ADD NEW CODE HERE...

                    Debug.Log("No water left");

               }

          IEnumerators require a return type. Which return type should we give it to trigger the Log at the correct time?

          1. yield return new WaitUntil(AnyWaterLeft);
          2. yield return new WaitWhile(AnyWaterLeft);
          3. return null;
          4. yield return new WaitForSeconds(null);

          Additional Information

          To help you further with this question, check out the following links from Unity's official scripting reference page:

          https://docs.unity3d.com/ScriptReference/WaitUntil.html

          https://docs.unity3d.com/ScriptReference/WaitWhile.html

          1. Your team has finished developing an application for their client. The client reviews the work, loves it, but wants a few changes to the banner and background colors. This can be easily achieved without any additional code added or changed. Your artist in the team has offered to apply the new changes.

            Additional Information

            Unit Testing – Testing each individual piece of code (scripts/classes)

            Integration Testing – Putting units together and making sure no errors are introduced

            Acceptance Testing – Customer checks to see whether the code/project meets their requirements

            Regression Testing – Checking to see that no new bugs have been introduced

          All tests have been made apart from one; based on the information given, which test resembles the client accepting this work?

          1. Acceptance Test
          2. Integration Test
          3. Unit Test
          4. Regression Test
          1. The following code spawns vampire bats in our game. When a bat goes into the beam of light, it will be destroyed. Each bat class holds a function called CheckForLight() and returns a bool.

          Here is a sample of the code:

          using System.Collections.Generic;

          using UnityEngine;

          public class VampireBats : MonoBehaviour

          {

               public GameObject batPrefab;

               public float spawnRate = 10f;

               private float timer = 0f;

               private List<Bat> bats;

               private void Start()

               {

                    bats = new List<Bat>();

               }

               private void Update()

               {

                    timer += Time.deltaTime;

                    if (timer > spawnRate)

                    {

                         SpawnBats();

                    }

               }

               private void SpawnBats()

               {

                    timer -= spawnRate;

                    GameObject spawnedBat =

                    Instantiate(batPrefab, transform);

                    Bat batToAdd =

                    spawnedBat.GetComponent<Bat>();

                    bats.Add(batToAdd);

               }

               public void BeamOfLight()

               {

                    //NEW CODE TO ADD

               }

          }

          The BeamOfLight() function will do the following:

          • Check every bat relating to the VampireBats script.
          • Get the returned bool from the bat's CheckForLight function.
          • If true, remove the bat's reference (take it off the list) and remove it from the game.

          Which for loop would fix the issue?

                      for (int i = bats.Count - 1; 1 >= 0; i--)

                      {

                           if (bats[i].IsInTheLight())

                           {

                                monsters.Remove(bats[i]);

                                Destroy(monsters[i].gameObject);

                           }

                 }

                            for (int i = 0; i < bats.Count; i++)

                        {

                             if (bats[i].IsInTheLight())

                             {

                                  bats.Remove(bats[i]);

                                  Destroy(bats[i].gameObject);

                             }

                        }

                            for (int i = 0; i < bats.Count; i++)

                        {

                             Bat thisBat = bats[i];

                             if (bats[i].IsInTheLight())

                             {

                                  bats.Remove(thisBat);

                                  Destroy(thisBat.gameObject);

                             }

                        }

                         for (int i = bats.Count - 1; i >= 0; i--)

                        {

                             Bat thisBat = bats[i];

                             if (bats[i].IsInTheLight())

                             {

                                  bats.Remove(thisBat);

                                  Destroy(thisBat.gameObject);

                             }

                        }

              1. The following code runs fine in the Unity Editor, but in a build it breaks.

              Here is a sample of the code:

              public class CoinCounter : MonoBehaviour

              {

                   private bool init;

              #if UNITY_EDITOR

                   public int CoinCollection { get; private set; }

              #else

                   CoinCollection = 1;

              #endif

                   public void Count()

                   {

                        CoinCollection += 1;

                        init = true;

                   }

                   public void Reset()

                   {

              #if UNITY_EDITOR

                        if (init)

                        {

                             CoinCollection = 0;

                        }

              #endif

                   }

              }

              What is causing the error in the build?

              1. The game works fine in the Editor; likely the system is faulty.
              2. Too many spaces in the code.
              3. CoinCollection is defined in the UNITY_EDITOR directives only.
              4. The Reset function isn't called.
              1. When we save the following code, it generates an error in the console:

                using System.Collections.Generic;

                using UnityEngine;

                public class GameManager : MonoBehaviour

                {

                     public static GameManager Instance

                     {

                          get;

                          private set;

                     }

                     private List<GameObject> objectsInTheScene;

                     public void Bucket(GameObject go)

                     {

                          objectsInTheScene.Add(go);

                     }

                }

                public class AnotherDumbClass : MonoBehaviour

                {

                     private void Start()

                     {

                          GameManager.Bucket(gameObject);

                     }

                }

                Additional Tip

                If you don't know the answer, try copying and pasting the code into an empty script to see whether you can try and solve the problem.

              What do you think is causing the error?

              1. An object reference is required for the non-static field, method, or property such as GameManager.Bucket(GameObject).
              2. Bucket isn't connected with Bitbucket.
              3. Start cannot be private.
              4. No error is generated.
              1. The following code is for a touchscreen game where a custard pie is launched in the opponent's face. It has been requested that the pie should be launched when the player takes their finger off the screen.

              A sample of code is as follows:

              using UnityEngine;

              public class StartGame : MonoBehaviour

              {

                   private void Update()

                   {

                        WaitingForTouch();

                   }

                   private void WaitingForTouch()

                   {

                        if (Input.touches.Length > 0)

                        {

                             Touch touch = Input.GetTouch(0);

                             if (/* ENTER CODE HERE */)

                             {

                                  LaunchCustardPieInTheirFace();

                             }

                        }

                   }

              }

              Which piece of code should be entered into the if statement's condition?

              1. If (touch.phase == TouchPhase.Ended)
              2. if (ALT+CTRL+DEL)
              3. if (touch.phase == TouchPhase.Begin)
              4. if(Input.GetFinger == null)
              1. While the scene is running in the Unity Editor, you press the Spacebar on the keyboard and observe the Inspector window. You notice the points variable is giving an inconsistent number of points when it increases.

              A sample of the code is as follows:

              using UnityEngine;

              public class ZoomPacer : MonoBehaviour

              {

                   public int points;

                   private void FixedUpdate()

                   {

                        if (Input.GetKeyDown(KeyCode.Space))

                        {

                             points++;

                        }

                   }

              }

              What could help calm the problem?

              1. Change FixedUpdate to Update as Update is called on every frame to check.
              2. Fire off an event every time the Spacebar is pressed.
              3. Change the points data type from int to float.
              4. Set a time delay for each Spacebar press, allowing cooling off after each press.
              1. We have been asked to create a basic prototype where a car drives into a wall and bounces off it with rigidbody physics.

              The GameObjects with their components are checked and set correctly, but there appears to be an issue with the code as the car drives right through the wall with no collisional reaction.

              A sample of the code is as follows:

              using UnityEngine;

              public class Car : MonoBehaviour

              {

                   public float wallImpactForce = 88f;

                   private void OnTriggerEnter(Collider other)

                   {

                        Rigidbody rb =

                        other.GetComponent<Rigidbody>();

                        rb.AddForce(Vector3.up * wallImpactForce);

                   }

              }

              What is causing the car to drive through the wall?

              1. Add a ForceMode.Impuse within the AddForce parameters.
              2. Reduce the car's mass.
              3. Increase the driver's mass.
              4. Reduce the project's timestep.
              1. You are working in a team where all members have different skills and potentially need to work on the same/similar files. Out of the following list, which would be the most helpful for the team?
                1. Prefabs
                2. Version Control
                3. Duplicating files offline
                4. Everyone working in separate folders
              2. The following code is a section of a delegate system where a piece of code can subscribe to. However, it is not possible to have delegates exposed in the Inspector.

              A sample of the code is as follows:

                   public delegate void EatFood();

                   public EatFood onTriggerFood;

                   void OnEnable()

                   {

                        onTriggerFood += Apple;

                   }

                   void OnDisable()

                   {

                        onTriggerFood -= Apple;

                   }

                   void Start()

                   {

                        onTriggerFood.Invoke();

                   }

                   void Apple()

                   {

                        Debug.Log("MUNCH");

                   }

              What would work as a good equivalent and expose its fields in the Inspector?

              1. Adding System.Serializable above the scripts class.
              2. Swapping out the delegate for a Unity Event system.
              3. Make delegates private and add a SerializeField attribute to them.
              4. This can't be done.
              1. We are working on a game with multiple levels. Each level has its own scene; it has been requested that when levels are changed, the content needs to remain in the scene as persistent data. But when the game closes, all data is wiped.

              What's the easiest way of carrying information from one scene to another and wiping its content when done?

              1. Add a GameObject to the Hierarchy with a component attached with all saved data. Then, add a DontDestroyOnLoad() function to it.
              2. Use PlayerPrefs to store all data and then, when the game quits, call PlayerPrefs.DeleteAll().
              3. Use PlayerPrefs to store scene data, then when a new level loads, copy the PlayerPrefs data to a new PlayerPrefs data and delete the previous level's PlayerPrefs data.
              4. Copy the GameObjects, then, when a new scene loads, paste the stored GameObjects into the new scene.
              1. One of the artists keeps noticing the swimmer in a game isn't swimming smoothly.

              The following is some sample code:

              public class Swimmer : MonoBehaviour

              {

                   [SerializeField]

                   private int swimmingSpeed = 30;

                  

                   private void FixedUpdate()

                   {

                        if (Input.GetKey(KeyCode.A))

                        {

              transform.position += new Vector3(1 , 0 , 0) * swimmingSpeed * Time.deltaTime;

                        }

                        if (Input.GetKey(KeyCode.D))

                        {

              transform.position -= new Vector3(1 , 0, 0) * swimmingSpeed * Time.deltaTime;

                        }

                   }

              }

              What can you do to help remedy this issue?

              1. Change FixedUpdate to Update.
              2. Ignore the artist; it seems fine to you.
              3. Condense if statements from two to just one.
              4. Add the two if statements into a method and apply it to FixedUpdate().
              ..................Content has been hidden....................

              You can't read the all page of ebook, please click here login for view all page.
              Reset