Unity Flashcards

Covers details specific to the Unity game engine

1
Q

List the 8 main methods provided by the Monobehaviour class.

A

Awake - Called when the script instance is loaded, even if it is disabled. It is called after all gameobjects are initialised, so useful for setting up references to other gameobjects and components.
OnEnable - Called whenever the object is enabled.
Start - Called just before any update functions are called for the first time. Can be used in conjunction with Awake to init references to other object components.
Update - Executed every frame regardless of time between frames. For most code, this is just fine.
FixedUpdate - Executed in fixed intervals independent of the framerate. Mostly used for physics calculations to keep in sync with the physics engine.
LateUpdate - Called after all other update methods are processed. Useful for issues like camera movement, to track objects that may have moved inside Update.
OnDisable - Called whenever the object is disabled.
OnDestroy - Called when the scene is destroyed. If the gameobject is destroyed directly, OnDisable, then OnDestroy are called.

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

Can the Unity API be run on different threads?

A

No, Unity API functions can only be called on the main thread. In addition texture and mesh modification cannot be done concurrently as they lie in GPU memory.

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

What is the difference between Update, FixedUpdate and LateUpdate? When would we use each?

A

Update - Executed every frame regardless of time between frames. For most code, this is just fine.
FixedUpdate - Executed in fixed intervals independent of the framerate. Mostly used for physics calculations to keep in sync with the physics engine.
LateUpdate - Called after all other update methods are processed. Useful for issues like camera movement, to track objects that may have moved inside Update.

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

What are coroutines?

A

Coroutines provide a solution to the lack of multithreading capability. They run on the main thread but execute every update, providing a pseudo-multithreaded approach.

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

What is an assetbundle? What do we use them for?

A

Assetbundles are files that contain non-code assets such as models, textures, prefabs, scenes. They can also have dependencies on each other (e.g. a material in one assetbundle can reference a texture in another assetbundle).

They are useful as they can serialize and compress data and be transmitted over networks.

Code objects can be serialized. When deserialized, they find an existing class definition and construct an instance using that definition.

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

What render pipelines are available? What are the differences between them?

A

Built-In - Well supported pipeline that works out of the box. Doesn’t allow for any customisability however.
URP (Universal Render Pipeline) - This is intended for creating applications that can run on multiple platforms, including mobile. Has no hardware requirements and access to the shader graph.
HDRP (High-Definition Render Pipeline) - Intended for publishing to high-end hardware with significant requirements. Supports raytracing, something URP cannot do.

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

What are the advantages / disadvantages of Unity vs Unreal?

A

Unity is much simpler to learn with far less overhead.
Unity is better for cross-platform, mobile and VR work as it has more support.
Unreal supports advanced graphics, lighting, physics and greater performance. It is more suited to graphics-intensive applications and AAA-quality games.
Both also have access to a large library of plugins, tools and support.

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