Unity - Create with Code - Unit 5 Review
Quiz by Kelly Herbert
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
- Q1
Which of the following follows Unity naming conventions (especially as they relate to capitalization)?
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:
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?
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?
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?
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?
“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?
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?
(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”?
Line 1
Line 2
Line 4
Line 3
300s