Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

DGD3 Unit 4 Review

Total questions: 10

Worksheet time: 11mins

Name
Class
Date
1.

If it says, “Hello there!” in the console, what was the code used to create that message?

a)

Debug(“Hello there!”);

b)

Debug.Log("Hello there!");

c)

Debug.Console(“Hello there!”);

d)

Debug.Log(Hello there!);

2.

If you want to destroy an object when its health reaches 0, what code would be best in the blank below?

a)

health > 0

b)

health.0

c)

health < 1

d)

health < 0

3.

The code below creates an error that says, “error CS1503: Argument 1: cannot convert from 'UnityEngine.GameObject[]' to 'UnityEngine.Object'”. What could you do to remove the errors?

a)

On line 5, change “enemyPrefabs” to “GameObject”

b)

On line 1, change “enemyPrefabs” to “enemyPrefabs[0]”

c)

On line 3, change “Start()” to “Update()”

d)

On line 5, change “enemyPrefabs” to “enemyPrefabs[0]”

4.

Which comment best describes the following code?

a)

// If player collides with another object, destroy player

b)

// If enemy collides with another object, destroy the object

c)

// If player collides with a trigger, destroy trigger

d)

// If player collides with another object, destroy the object

5.

If you want to move the character up continuously as the player presses the up arrow, what code would be best in the two blanks below:

a)

GetKey(KeyCode.UpArrow)

b)

GetKeyDown(UpArrow)

c)

GetKeyUp(KeyCode.Up)

d)

GetKeyHeld(Vector3.Up)

6.

You are trying to randomly spawn objects from an array. However, when your game is running, you see in the console that there was an “error at Assets/Scripts/SpawnManager.cs:5. IndexOutOfRangeException: Index was outside the bounds of the array.” Which line of code should you edit in order to resolve this problem and still retain the random object functionality?

a)

Line 2

b)

Line 3

c)

Line 4

d)

Line 5

7.

If you have made changes to a prefab in the scene and you want to apply those changes to all prefabs, what should you click?

a)

The “Create” drop-down at the top of the Hierarchy

b)

The “Open” button at the top of the Inspector

c)

The “Overrides” drop-down at the top of the Inspector

d)

The “Add Component” button at the bottom of the Inspector

8.

Read the documentation from the Unity Scripting API below. Which of the following is a correct use of the InvokeRepeating method?

a)

InvokeRepeating(“Spawn, 0.5f, 1.0f”);

b)

InvokeRepeating(“Spawn”, 0.5f, 1.0f);

c)

InvokeRepeating(“Spawn", gameObject, 1.0f);

d)

InvokeRepeating(0.5f, 1.0f, “Spawn”);

9.

You’re trying to create some logic that will tell the user to speed up if they’re going too slow or to slow down if they’re going too fast. How should you arrange the lines of code below to accomplish that?

a)

4, 6, 1, 2, 5, 9, 7, 8, 3

b)

6, 1, 2, 5, 7, 8, 3, 4, 9

c)

7, 8, 3, 4, 6, 5, 2, 1, 9

d)

7, 8, 3, 4, 6, 1, 2, 5, 9

10.

This part of Unity allows you to edit prefabricated objects and features an auto-save function.

a)

Scene

b)

Prefab Folder

c)

Hierarchy

d)

Prefab Preview