Coroutines and Crosshair Flashcards

1
Q

How do you make a coroutine?

A

IEnumerator

e.g. private IEnumerator Sphere(Vector3 pos)

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

How do you pause and resume a coroutine?

A

Use the yield keyword.

Often used like:

yield return new WaitForSeconds(1)

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

How do you initialise a GUI?

A

Make the function:

void OnGUI()
{
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How do you add text to the GUI?

A

GUI.Label(new Rect(posX, posY, size, size), “text”)

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

How do you make a new primitive shape?

A

GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere)

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

How do you delete GameObjects?

A

Destroy(GameObject)

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

What are coroutines?

A

Similar to functions but executes incrementally over time instead of waiting until it is finished.

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