Unity Basics Flashcards
What should the Y axis be to position a gameobject perfectly level on a plane?
0.5
How to add physics to a gameobject?
Add a rigidbody component
When is Update() called?
Before rendering a frame
When is FixedUpdate called?
Before performing any physics calculations
What is an easy way to have the camera follow a gameobject?
Make the camera a child of the gameobject
Which Update() is best to use for follow cameras, procedural animations, and gathering last known states?
LateUpdate()
What is a prefab?
A prefab is an asset that contains a template or blueprint of a game object or game object family
What happens when you make a change to a prefab?
All of the prefab instances in the game will be updated with the changes.
How to make a game object dynamic?
Add a collider and a rigid body
What determines whether a collider is static or not?
Whether or not it has a rigid body
How to prevent an object with rigid body to react to physics?
Make the rigid body kinematic
If a collider is moving or rotating (not static like a wall), what should you do to prevent the collider from being cached every frame?
Make the collider dynamic by adding a rigid body
How are kinematic rigid bodies moved?
By using their transform
How do you use a mesh collider alongside a rigid body?
Mark it as convex
how would you write a 0.0 float in unity c#?
0.0f
How would you make a custom class visible in the inspector and usable by other classes?
Add [System.Serializable] before the class
Name a shader that would remove black from a material (transparent)
Particles/Additive
What is the point of using mobile shaders?
They are a more efficient use of resources
What is the disadvantages of using mobile shaders
You lose some quality and control
How to access functions and variables from another class?
You must first make a reference to the instance of the class by finding the associated game object holding said instance.
ex:
public GameController gameController;
GameObject gameControllerObject = GameObject.FindWithTag(“GameController”);
gameController = gameControllerObject.GetComponent();
gameController.AddScore(scoreValue);
How would you get the input key R?
Input.GetKeyDown(KeyCode.R)
How to pivot around selected object with camera?
Select an object and press F to focus on it. Then, when you use the view orbit tool, it’ll rotate around that object (and its children).
Describe an easy way to add a texture to a material
Change shader to legacy/diffuse and then you can add a texture
what is directional light mainly used for
global lighting. think of it as the sun or moon