Unity Basics Flashcards

1
Q

What should the Y axis be to position a gameobject perfectly level on a plane?

A

0.5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How to add physics to a gameobject?

A

Add a rigidbody component

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

When is Update() called?

A

Before rendering a frame

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

When is FixedUpdate called?

A

Before performing any physics calculations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is an easy way to have the camera follow a gameobject?

A

Make the camera a child of the gameobject

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which Update() is best to use for follow cameras, procedural animations, and gathering last known states?

A

LateUpdate()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is a prefab?

A

A prefab is an asset that contains a template or blueprint of a game object or game object family

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What happens when you make a change to a prefab?

A

All of the prefab instances in the game will be updated with the changes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to make a game object dynamic?

A

Add a collider and a rigid body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What determines whether a collider is static or not?

A

Whether or not it has a rigid body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to prevent an object with rigid body to react to physics?

A

Make the rigid body kinematic

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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?

A

Make the collider dynamic by adding a rigid body

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How are kinematic rigid bodies moved?

A

By using their transform

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How do you use a mesh collider alongside a rigid body?

A

Mark it as convex

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

how would you write a 0.0 float in unity c#?

A

0.0f

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How would you make a custom class visible in the inspector and usable by other classes?

A

Add [System.Serializable] before the class

17
Q

Name a shader that would remove black from a material (transparent)

A

Particles/Additive

18
Q

What is the point of using mobile shaders?

A

They are a more efficient use of resources

19
Q

What is the disadvantages of using mobile shaders

A

You lose some quality and control

20
Q

How to access functions and variables from another class?

A

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);

21
Q

How would you get the input key R?

A

Input.GetKeyDown(KeyCode.R)

22
Q

How to pivot around selected object with camera?

A

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).

23
Q

Describe an easy way to add a texture to a material

A

Change shader to legacy/diffuse and then you can add a texture

24
Q

what is directional light mainly used for

A

global lighting. think of it as the sun or moon

25
Q

What does the UV in UV mapping stand for?

A

In simple terms, X,Y,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.

26
Q

How would you make a variable public without having it show in the inspector?

A

Encapsulate it!
in visual studio: right click, refactor, encapsulate

public int EmptySlots {
    get {
        return emptySlots;
    }

    set {
        emptySlots = value;
    }
27
Q

What are the two main ways that programs can respond to changes in the world?

A

Polling and Events

28
Q

How do you setup the EventSystem to raycast out into the scene?

A

By adding a Physics Raycaster to the camera

29
Q

How to make a variable public in a script but hide it in the inspector?

A

[HideInInspector] before the variable

30
Q

How to add a tooltip to a variable that can be seen in the editor when hovering the variable?

A

[Tooltip(“Add this before the variable in the script”)]

31
Q

What does kinematic mean?

A

If isKinematicisenabled, Forces, collisions or joints will not affect the rigidbody anymore. The rigidbody will be under full control of animation or script control by changing transform.position.Kinematicbodies also affect the motion of other rigidbodies through collisions or joints

32
Q

What is the difference between a material and a texture?

A

Textures are just .png or .tiff images that you can access via MS paint, photoshop, etc. However, materials contain a variety of things. Heightmaps/Normalmaps are images that are usually blueish/pinkish and are calculated by Unity to show depth in a short of illusion. If you stand a few meters away, bricks will look like they have tiny crevaces, water will look like it has actual waves, carpet will look like it has some fibers sticking out. However if you get close enough, it’ll just be a flat shape (assuming you’ve placed it on a cube).

In short, a material contains a set of information for 3D looks, and may even contain physics information. A texture is just a picture.

33
Q

What is the difference between a material and a shader?

A

A material is what you apply to geometry to give it a colour and pattern. A texture is a component of a material.

A shader is a small program that allows this material to be rendered at runtime. The nice thing about shaders is that you can do everything from simply rendering the material, to adding dynamic effects like specular highlights and reflections all the way up to extremely clever things such as rendering fake holes through walls where a bullet has hit.