
Unity gMetrix Module 8
Authored by Raymundo Martinez
Computers
12th Grade
Used 1+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
5 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
10 mins • 1 pt
Which of the following methods is a loop automatically called by Unity and is great for performing physics operations because the time between each call is consistent?
FixedUpdate
UpdatePhysics
UpdateFixed
Update
Answer explanation
FixedUpdate works great with physics because the time between calls is always the same.
2.
MULTIPLE CHOICE QUESTION
10 mins • 1 pt
A programmer is trying to create some simple code to print the player's name. However, the following error is being printed to the Console: "UnassignedReferenceException: The variable player of PrintPlayerName has not been assigned." Why is this happening?
The player GameObject was not assigned in the Inspector.
The GameObject does not have a name field inside.
The wrong GameObject was assigned in the Inspector.
The player variable should be public to be able to assign it in the Inspector.
Answer explanation
The error is occurring because the player GameObject was not assigned in the Inspector. Trying to access a serialized field will cause an UnassignedReferenceException
when not assigned in the Inspector.
3.
MULTIPLE CHOICE QUESTION
10 mins • 1 pt
Consider the following two classes:
Why is the Console window showing the error "'car.speed' is inaccessible due to its protection level"?
The car variable in GameController should be public.
The speed variable in the Car class is not serialized.
The GameController class should inherit from the Car class.
The speed variable in the Car class needs a public access modifier.
Answer explanation
To access a field in a different class, there needs to be a public access modifier.
4.
MULTIPLE CHOICE QUESTION
10 mins • 1 pt
Consider the following code:
The Console is showing the following error: "Cannot implicitly convert type 'float' to 'int'. An explicit conversion exists (are you missing a cast)?" What is causing this error?
The playerSpeed variable can only store integer values.
It is impossible to cast a float value into an integer value.
Float values do not require an "f" suffix when using integer type.
The speed of the player is a float value, but Unity only accepts integers values for speed.
Answer explanation
The playerSpeed variable can only store integer values. To store a number with decimals, we need to use the proper variable type, such as a float.
5.
MULTIPLE CHOICE QUESTION
10 mins • 1 pt
You are trying to get a reference to a Text element on the UI using the Inspector window with the following code:
[SerializeField] Text myUIText;
However, the following error is appearing: "The type or namespace name 'Text' could not be found (are you missing a using directive or an assembly reference)?" What is causing this error?
To get a reference using the Inspector, variables should be public.
The namespace UnityEngine.UI is not imported into the script.
The Text class does not exist.
The type Text should be all lowercase.
Answer explanation
The class Text can only be used when namespace UnityEngine.Ul is added to the top of the script.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?