Unity Basics Flashcards
How do you add physics to a gameobject?
Add a rigidbody component
When is FixedUpdate called?
Before performing any physics calculations
When is Update() called?
Before rendering a frame
What is an easy way to have the camera follow a gameobject?
Make the camera a child of the gameobject
Which Update() is best used to 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 do you prevent an object with rigid body from reacting 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 manipulating their transform
How do you use a mesh collider alongside a rigid body?
Mark it as convex
how would you write the value of 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 are the disadvantages of using mobile shaders
You lose some quality and control
How would you get the input key R?
Input.GetKeyDown(KeyCode.R)
How do you pivot around a selected object with camera?
Select an object and press F to focus on it. Then, you use the orbit tool, to 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
A global lighting such as the sun or moon.
What does the UV in UV mapping stand for?
X,Y and Z are spacial co-ordinates while U,V,W are surface/mesh co-ordinates. This process projects a texture map onto a 3D object. The letters “U” and “V” denote the axes of the 2D texture because “X”, “Y” and “Z” are already used to denote the axes of the 3D object in model space.
What are the two main ways that programs can respond to changes in the world?
Polling and Events
How do you setup the EventSystem to raycast out into the scene?
By adding a Physics Raycaster to the camera
How to make a variable public in a script but hide it in the inspector?
Add [HideInInspector] before the variable
What do you do if the pivot will not change on an element?
Change the Tool Handle mode to Pivot instead of Center
How do you change an image file (png/jpg) to a sprite?
Change Texture type to Sprite (2D and UI) and apply
If a room or structure is not casting a shadow, why is this happening and how can you fix this?
It’s happening because the normals are flipped. You can fix this by creating a box around it with the normals flipped the other direction
What is Volumetric lighting?
Volumetric lighting is a technique to add lighting effects that allow the viewer to see beams of light shining through the environment
What is a positve of using a spritesheet vs multiple sprites?
Saves memory
What Sprite Mode should a spritesheet have?
Multiple
The unity scene view is comprised of what?
Units