0% found this document useful (0 votes)
21 views

Study Guide

Unity is single-threaded but supports multithreading through custom coding like jobs. Coroutines are commonly used to trigger actions from the main thread using yield wait. Only the main thread can modify textures at runtime and threads cannot directly move game objects since the transform is not thread-safe. Time.deltaTime and FixedUpdate ensure things happen at fixed intervals regardless of framerate.

Uploaded by

Ashsahd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Study Guide

Unity is single-threaded but supports multithreading through custom coding like jobs. Coroutines are commonly used to trigger actions from the main thread using yield wait. Only the main thread can modify textures at runtime and threads cannot directly move game objects since the transform is not thread-safe. Time.deltaTime and FixedUpdate ensure things happen at fixed intervals regardless of framerate.

Uploaded by

Ashsahd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

UnityEngine is single-threaded, multithreading requires custom coding such as

through the job system. Coroutines are the usual workaround, which use yield wait
to trigger from the main thread

Thread Safety:
Only main thread can modify texture at runtime because it lives in GPU
Threads cannot move a game object by position/rotation because fetching transform
is not thread safe

Time.deltaTime is important in the same way FixedUpdate is - it guarantees things


happen at fixed intervals regardless of framerate

Single-responsibility principle
Classes should exist to do one thing and only one thing

Open-closed principle
(Generally) design classes to be open for extension, closed for modification.
(Exceptions for design patterns like StateMachine?)

Liskov substitution principle


Classes and sub-classes must be interchangeable without breakage

Interface segregation principle


Many client-specific interfaces are better than one general-purpose interface. We
should only care about relevant interfaces, there is no need to load them all

Dependency inversion principle


Loosely couple software using abstract classes / interfaces

A Singleton can/should only exist once - multiple instance will break it and should
be never necessary (IE Physics System). Considered bad practice in Unity due to low
upfront costs but higher as time goes on, as it tends to get code more tightly
coupled

Static keyword - share among all objects of the class, doesn't need (or can have)
an instance to reference

Multithreading - running in parallel (must be async)


Async - asynchronous sequence of tasks (can be multithreaded or singlethreaded)
Coroutines are similar to Aync, but different - couroutines can run on a frame by
frame basis, whereas async can be called when something else finished?

Class - Reference type, references/points to variable data (change one, change all)
Struct - Value type, directly contains variable data (change one, just that one)

-Pathfinding-

One source, all destinations:


Breadth First Search - used for unweighted graphs, uses queue
Dijkstra's - used for weighted graphs, uses priority queue (can't be done super
easily in Unity since you have to create your own priority queue class)

One source, one destination


A Star - Dijkstra's but guesses its way toward single target in a graph
Unity Function Order

Awake - Initialize
OnEnable
Start - Only once

FixedUpdate
Update
LateUpdate - before rendering

OnGUI
OnApplicationPause
OnApplicationQuit

OnDisable
OnDestroy

Space Complexity - Amount of RAM you eat up


Time Complexity - Length of time to run

RESTful API - Representational State Transfer, exposes endpoints on services of a


server that can be talked to by a client

CRUD Operations - HTTP Methods:


CREATE - POST
READ - GET
UPDATE - PUT
DELETE - DELETE

TCP vs UDP:
TCP is connection-oriented, slow but guaranteed, used by critical applications.
TCP/IP is used to connect directly with machines outside of the internet.
UDP is connectionless, fast but NO guarantee of transmission, making it less
consistently reliable. Used by Real-Time Applications that want to stay up to date
as much as possible but can afford to miss updates (displaying graphics / UI)

You might also like