placeholder image to represent content

Unity - Create with Code - Unit 5 Review

Quiz by Kelly Herbert

Our brand new solo games combine with your quiz, on the same screen

Correct quiz answers unlock more play!

New Quizalize solo game modes
10 questions
Show answers
  • Q1

    Which of the following follows Unity naming conventions (especially as they relate to capitalization)?

    Question Image

    Line 3

    Line 1

    Line 4

    Line 2

    300s
  • Q2

    If there is a boolean in script A that you want to access in script B, which of the following are true:

    Question Image

    1, 2, and 3 only

    All are true

    3 and 4 only

    2 and 3 only

    1 only

    1 and 2 only

    300s
  • Q3

    Which code to fill in the blank will result in the object being destroyed?

    Question Image

    name == “player” && !isDead && health < 5

    name = “player” && isDead && health < 5

    name != “player” && isDead != true && health > 5

    name == “player” && isDead != true && health > 5

    300s
  • Q4

    You run your game and get the following error message in the console, “NullReferenceException: Object reference not set to an instance of an object”. Given the image and code below, what would resolve the problem?

    Question Image

    On Line 3, remove the GetComponent code

    In the hierarchy, rename “Game Manager” as “GameManager”

    On Line 1, rename “GameManager” as “Game Manager”

    In the hierarchy, rename “Game Manager” to “gameManager”

    300s
  • Q5

    Read the Unity documentation below about the OnMouseDrag event and the code beneath it. What will the value of the “counter” variable be if the user clicked and held down the mouse over an object with a collider for 10 seconds?

    Question Image

    1

    0

    100

    99

    A value over 100

    300s
  • Q6

    Based on the code below, what will be displayed in the console when the button is clicked?

    Question Image

    “Button is ready”

    “Welcome, firstName Smith”

    “Welcome, Robert Smith”

    “Welcome + Robert + Smith”

    300s
  • Q7

    You have declared a new Button variable as “private Button start;”, but there’s an error under the word “Button” that says “error CS0246: The type or namespace name 'Button' could not be found (are you missing a using directive or an assembly reference?)” What is likely causing that error?

    “Button” should be lowercase “button”

    You can’t name a button “start” because that’s the name of a Unity Event Function

    New Button variables must be made public

    You are missing “using UnityEngine.UI;” from the top of your class

    300s
  • Q8

    Look at the documentation and code below. Which of the following lines would NOT produce an error?

    Question Image

    Line 5

    Line 8

    Line 6

    Line 7

    300s
  • Q9

    If you wanted a button to display the message, “Hello!” when a button was clicked, what code would you use to fill in the blank?

    Question Image

    (SendMessage(string Hello));

    (SendMessage(“Hello”));

    (SendMessage);

    (SendMessage(Hello));

    300s
  • Q10

    Which of the following is the correct way to declare a new List of game objects named “enemies”?

    Question Image

    Line 1

    Line 2

    Line 4

    Line 3

    300s

Teachers give this quiz to your class