Unity gMetrix Module 5
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Raymundo Martinez
Used 1+ times
FREE Resource
Enhance your content in a minute
5 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
5 mins • 1 pt
Which of the following components do you need to properly set up physics based on a 2D Player character? (Choose two)
Rigidbody2D
Rigidbody
Trigger
2D Collider
Answer explanation
With only a Rigidbody2D and a 2D type collider, you can set up a physics-based 2D GameObject.
2.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
A programmer created the code below to read input from the user and make the character jump when the Space key on the keyboard is pressed. The problem is that the character flies too high when the user presses the key. What is causing this issue?
bool fly;
void Update(){
if(Input.GetKey(Keycode.Space)){
fly = true;
}
}
void FixedUpdate(){
if(fly){
fly = false;
rb.AddForce(Vector3.up, ForceMode. Impulse);
}
}
Rigidbody mass is too low.
GetKey gets called every frame the key is pressed.
Input reading must be done on FixedUpdate.
Force should be multiplied by Time.deltaTime.
Answer explanation
In this case, the issue is that GetKey gets called every frame the key is pressed. To fix the issue, GetKey should be replaced by GetKeyDown to work only on the first frame
the key gets pressed.
3.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
The following code is assigning a vector to the player's transform position. What behaviour will this cause on the player GameObject? Vector2 customVector; void Start(){ customVector = -Vector3.up; } void Update(){ transform.position += customVector; }
Moves the player to the right
Moves the player forward
Moves the player to the left
Moves the player down
Answer explanation
It will move the player down because a negative version of Vector2.up is equal to Vector2.down.
4.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Select the proper combination of code snippets that will create a valid method that reads Input from the player: 1:{ 2: void ReadInputFromPlayer( 3: Input.GetKeyDown(KeyCode.W)(){ 4:} 5: if(Input.GetKeyDown(KeyCode.W)){
1, 2, 3, 4
2, 4, 2, 3
2, 1, 3, 4
2, 1, 5, 4
Answer explanation
2, 1, 5, 4 is the only combination that has the proper order and condition to ask for input.
5.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Select the combination of code snippets that will properly declare a variable not accessible from another script but available in the Inspector.
1: power = 1;
2: [SerializeField]
3: public
4: private
5: int
6: static
3, 6, 5, 1
2, 3, 5, 1
4, 6, 5, 1
2, 4, 5, 1
Answer explanation
When you need to have a variable available in the Inspector but keep it private, the proper way is to use a combination of private access modifier and the [SerializeField]
attribute, so 2, 4, 5, 1 is the correct order.
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?
Similar Resources on Wayground
10 questions
Go Beyond the Sales LAP Quiz
Quiz
•
9th - 12th Grade
10 questions
Review I-PM Ujikom Multimedia
Quiz
•
12th Grade
10 questions
Unit 4 Advanced AP CSP
Quiz
•
9th - 12th Grade
10 questions
Kuis library JMF
Quiz
•
9th - 12th Grade
10 questions
Powerpoint Quiz
Quiz
•
9th - 12th Grade
10 questions
Microsoft Teams
Quiz
•
KG - 12th Grade
10 questions
Emerging technologies
Quiz
•
6th Grade - University
10 questions
Parcial-Dibujo
Quiz
•
12th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
