The Main Interface Windows in the Unity Editor(5)
Scene/Game View. Scene Hierarchy. Inspector Window. Project Files.
______ defines the behavior and properties of a Game Object.
(Hint: In Inspector window)
What are Components.
Oh no! I’m getting an error after pasting the script. It says the script cannot be found.
What could be the prime cause of this?
What is…
The name of the script does NOT match the name next to MonoBehavior.
How do I access the rigidbody of an object in C#?
“rb = __________”
What is
rb = GetComponent<Rigidbody>();
What are conditionals (if statements) used for?
Conditionals are used to make decisions in your code.
Basic Objects in Unity is called
Game Objects
What do we use to determine the boundaries of a Game Object in our game
What are Colliders?
What are the different types of variables we’ve worked with in C#?
What is...
Int, String And Bool.
How would we write a movement script in the horizontal axis (A,D and arrow keys: left, right)
float moveHorizontal = _____________;
(Hint: we’re using unity’s keyword library instead of grabbing individual keys).
float moveHorizontal = Input.GetAxis(“Horizontal”);
What is the correct syntax (structure) of a conditional (if statement)?
if (condition) {
//code to execute if the condition is true
}
How can we implement physics into our game?
Using Rigidbody and Colliders.
Name at least 3 different colliders we attach to our game objects.
Box, Sphere, Capsule, Mesh Collider, Terrain Collider.
What is the difference between a Start() and an Update() method?
What is…
Start() methods only occurs at the beginning of the program.
Update() continues checking throughout the program.
private bool name = Physics.Raycast(transform.position, Vector3.down, 1.1f, groundLayer);
What does this line of code do? We’ve used this before.
What is isGrounded();
Checking for ground layer to make sure there is no second jump.
What is the output of this code?
int playerScore = 10;
if (playerScore > 5) {
Debug.Log("Player is doing well!");
}
Player is doing well!
What are prefabs? How can we create a prefab?
Prefabs are pre-configured templates of Game Objects that we can reuse anytime.
Creating a Prefab requires dragging the finished gameobject into your project files window. (Usually into your prefab folder)
My player has rigidbody attached but when I press play, my player is stuck in midair without any movement.
What could be the problem?
What is unchecking isKinematic, and isGravity?
What are the three values that a Vector3 intakes?
Bonus points to write out a new Vector3 variable.
What is (x, y, z)?
Vector3 Position = new Vector3(0, 0, 0)
float int hp = 100.0f;
float int speed = 10.0f;
if (hp > 50)
{
speed = 30.0f;
}
What is the output of the following code?
int playerHealth = 80;
if (playerHealth <= 20) {
Debug.Log("Player is critically injured.");
} else if (playerHealth <= 50) {
Debug.Log("Player is moderately injured.");
} else {
Debug.Log("Player is in good health.");
}
Player is in good health.
In our Unity Inspector Window, we can apply a _____ to keep certain game objects in categories.
Allows us to target specific categories to act in a certain way inside of our script.
(Hint: we used this to collect coins)
What are tags?
How can we use scripts to access real time properties of a Game Object in the inspector window?
What are Public Variables?
I want to detect collision between my player and an item on the screen.
What methods would we use to detect collision?
What is …
OnCollisionEnter or
OnTriggerEnter
How do we write a for loop?
I want it to Debug.Log("hello world") ten times.
for (int i = 0; i < 10; i++)
{
Debug.Log("hello world");
}
What's the output of the following code?
int playerHealth = 50;
if (playerHealth <= 20) {
Debug.Log("Player is critically injured.");
} else if (playerHealth <= 50) {
Debug.Log("Player is moderately injured.");
} else {
Debug.Log("Player is in good health.");
}
Player is moderately injured.