Gmetrix Unity Certified User Programmer

0.0(0)
studied byStudied by 1 person
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/99

flashcard set

Earn XP

Description and Tags

gmetrix

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

100 Terms

1
New cards

Semicolon

Every line of C# is called a statement and must end with a to separate them for the code complier process

2
New cards
3
New cards

public int myAge = 16;

4
New cards

Variable

a tiny section of your computer's memory that holds an assigned value. Every variable keeps track of where its information is stored (this is called a memory address), its value, and its type (for instance, numbers, words, or lists).

5
New cards

Operators

A symbol that tells the compiler to perform specific mathematical or logical manipulations.

6
New cards

Methods

can perform an operation and return the result. For instance, a _ can add numbers, return the sum, and store the sum in a variable.

7
New cards

Control-Flow

One of the central duties of a computer is to control what happens when predetermined conditions are met. When you click on a folder, you expect it to open; when you type on a keyboard, you expect the text to mirror your keystrokes. Writing code for applications or games is no different - they both need to behave in a certain way in one state and in another when conditions change.

8
New cards

Selection Statement

The if-else and switch selection statements allow you to specify branching paths, based on one or more conditions, and the actions you want to be taken in each case. They include the following

9
New cards
  • Detecting user input
10
New cards
  • Evaluating expressions and Boolean logic
11
New cards
  • Comparing variables or literal values
12
New cards

if-else

statement is the most common way of making decisions in code.

13
New cards

For example, if my condition is met, execute this block of code; if it's not, execute this block of code.

14
New cards

Arrays

_ are the most basic collection that C# offers. Think of them as containers for a group of values, called elements in programming terminology, each of which can be accessed or modified individually

15
New cards
  • _ can store any type of value; all the elements need to be of the same type
16
New cards

Lists

collecting multiple values of the same type in a single variable. They are much easier to deal with when it comes to adding, removing, and updating elements, but their elements aren't stored sequentially. This can, sometimes lead to a higher performance cost over arrays

17
New cards

Performance cost

refers to how much of a computer's time and energy a given operation takes up.

18
New cards

Dictionaries

To initialize a dictionary with key-value pairs, do the following

19
New cards
  • Use a pair of curly brackets at the end of the declaration
20
New cards
  • Add each element within its pair of curly brackets, with the key and the value separated by a comma
21
New cards
  • Separate elements with a comma, except the last element where the comma is optional
22
New cards

Classes

blueprints for objects and can be treated as custom variables and are reference types

23
New cards

Structs

are like classes, they are blueprints for objects, the difference is that they are value types

24
New cards

OOP

Object Oriented Programming is the concept of using objects as parent containers made up of multiple components

25
New cards

Where is OnTriggerEnter called?

In the FixedUpdate

26
New cards

What does the Hierarchy window contain?

A list of every GameObject in the current scene

27
New cards

What is the topmost GameObject on the Hierarchy called? What are the GameObjects below called?

the Parent/ Children or ChildObjects

28
New cards

What does the Game View Window display?

A representation of our game when running in Play Mode.

29
New cards

What does the display drop-down may do?

It allows us to select different values to see how it will look on devices with different aspect ratios and resolutions. You wouldn't want distortion or a menu to be cut off.

30
New cards

Scale slider

Allows you to zoom in and examine areas of the Game View Window in more detail.

31
New cards

Stats button

Toggles the statistics overlay containing rendering statistics about our game's audio and graphics to monitor the performance of our game while in play mode.

32
New cards

What does the Gizmos button do?

It enables the visibility of gizmos, used to give visual debugging or setup aids in the game view.

33
New cards

Project window

allows us to easily access and manage all our assets in our project.

34
New cards

= operator

Assigns the value of the right-hand operand to the object denoted by the left-hand operand.

35
New cards

How is an operator null?

If the variable does not use an assignment operator, such as =, then the variable is null.

36
New cards

>

Greater than

37
New cards

<

Less than

38
New cards

=

Greater than or equal to

39
New cards

<=

Less than or equal to

40
New cards

==

Equal to

41
New cards

!=

Not equal to

42
New cards

!

Not

43
New cards

&&

And

44
New cards

II

Or

45
New cards

++ (example i++)

Increments by 1

46
New cards

-- (example i--)

Decrements by 1

47
New cards

%

Remainder, also known as Modulus

48
New cards

Where can scripted variables be edited?

They can edited in the Inspector window; however, the access modifiers must be declared as public for them to appear in the Inspector window

49
New cards

(True or False) A variable is declared private. It appears in the inspector menu.

False

50
New cards

How is a private variable accessed locally?

Within the PlayerController class.

51
New cards

NullReferenceException

A procedure is called when the result is not possible

52
New cards

Animation Parameters

(Used to communicate between scripting and the Animator Controller) Variables that are defined within an Animator Controller that can be accessed and assigned values from scripts.

53
New cards

SetFloat

A number with a fractional part

54
New cards

SetTrigger

A whole number

55
New cards

SetBool

True or false value

56
New cards

SetFloat Example

("Forward", 10.0f)

57
New cards

SetInteger Example

("Forward", 5);

58
New cards

SetBool Example

("Forward", false);

59
New cards

Example of a SetTrigger animation function

SetTrigger("Die");

60
New cards

//

Single line comment

61
New cards

/* */

Multiple line comment

62
New cards

Public

The access modifier, access modifiers are applied to the declaration of a class, method, properties, fields, and other members. They define the accessibility of the class and its members. Public private, protected, and internal are access modifiers in C#.

63
New cards

Void

The return type; void is used where there is no data. For example, if a method does not return any value then you can specify void as a return type.

64
New cards

MyMethod

The method (function) name, followed by parenthesis with two parameters we pass, int and string are the parameter type and parameter1 and parameter2 are the parameters' name.

65
New cards

How are Awake and Start similar?

They're two of the first few functions called when a script is activated, only called once, and are used to initialize the script.

66
New cards

Why would someone use the Awake function?

They would use Awake to initialize a script using only itself and its game object

67
New cards

Why would someone use the Start function?

They would use Start to further initialize based upon values in other scripts. For example, say we have a PlayerScript and a ShieldScript

68
New cards

OnEnable

is like Awake and Start, but it is called every time the script is activated. This makes it an ideal place for subscriptions or other initialization done on each activation. If you put subscriptions in OnEnable and unsubscribe during OnDisable, you can avoid extra code execution on unused objects.

69
New cards

Why is Init seen as superior compared to the other methods?

None of the other methods are called until the game object is activated.

70
New cards

Input.GetButton

Input.GetButtonDown, and Input.GetButtonUp are public static bools (true or false).

71
New cards

Input.GetButton

returns true when the button has been pressed, held down, and not released. It will return false when the button is released.

72
New cards

Input.GetButtonDown

returns true during the frame the user pressed down on the button. It will not return trueuntil the user has released the key and pressed it again.

73
New cards

Input.GetButtonUp

returns true during the frame the user releases the button. It will not return true until the user has pressed the button and released it again.

74
New cards

Input.GetMouseButton(int button)

Input.GetMouseButtonDown(int button);, and Input.GetMouseButtonUp(int button);, and work similarly to the Input.GetButton methods. They are public static bools (true or false).

75
New cards

Input.GetMouseButton(int button)

returns true while the given mouse button is pressed down and held down.

76
New cards

Input.GetMouseButtonDown(int button)

returns true during the frame the user pressed down the given mouse button.

77
New cards

Input.GetMouseButtonUp(int button)

returns true during the frame the user releases the given mouse button.

78
New cards

Input.GetKey

Is a public static bool (true or false). Returns true while the user holds down the key identified by name.

79
New cards

Input.GetKeyDown

Is a public static bool (true or false). Returns true during the frame the user starts pressing down the key identified by name.

80
New cards

Input.GetKeyUp

Is a public static bool (true or false). Returns true during the frame the user releases the key identified by name.

81
New cards

What can Input.GetKey be used for?

It can be used as a parameter to the method(function) to detect and return true when the user presses the up arrow key, down arrow key, left arrow key, or right arrow key.

82
New cards

For loop

Executes a statement or code block multiple times using the for loop, structure of the for loop, nested for loops, and how to exit from the for loop.

83
New cards

Initializer

Used to initialize a variable that will be local to a for loop and cannot be accessed outside loop. It can also be zero or more assignment statements, method call, increment, or decrement expression e.g., ++i or i++, and await expression.

84
New cards

Condition

The condition is a boolean expression that will return either true or false. If an expression evaluates to true, then it will execute the loop again; otherwise, the loop is exited.

85
New cards

Iterator

Defines the incremental or decremental of the loop variable.

86
New cards

What can Animator.SetBool be used for?

To pass Boolean values to an Animator Controller via script.

87
New cards

Random.Range

Returns a random float number between and min [inclusive] and max [inclusive]

88
New cards

What does _Color do?

It sets a color to an object

89
New cards

What is an example of a code bing used to set a color to an object?

("_Color", Color.red);

90
New cards

When is OnCollision called?

Called when this collider/rigidbody has begun touching another rigidbody/collider. Incontrast to OnTriggerEnter. Is not a collider.

91
New cards

When is OnCollisionStay called?

Called once per frame for every collider/rigidbody that is touching rigidbody/collider. In contrast to OnTriggerStay. Is not a collider.

92
New cards

When is OnCollisionExit called?

Called when this collider/rigidbody has stopped touching another rigidbody/collider. In contrast to OnTrgiggerExit. Is not a collider.

93
New cards

When/Where is OnTriggerEnter called?

When a GameObject collides with another GameObject. It happens on the FixedUpdate function.

94
New cards

When is OnTriggerExit called?

When the Collider other has stopped touching the trigger.

95
New cards

When is OnTriggerStay called?

Almost all the frames for every Collider other that is touching the trigger. The function is on the physics timer, so it won't necessarily run every frame.

96
New cards

What is Transform.position?

The Vector 3 position, the position of the GameObjects transform in world space.

97
New cards

What is Vector3.zero?

It's shorthand for Vector3(0, 0, 0)

98
New cards

How do I rotate an object in code?

Use Transform.Rotate

99
New cards

How do I rotate using Euler angles?

Using Transform.eulerAngles

100
New cards

When using any variance of Input.GetMouseButton, what does 0 , 1 , and 2 mean?

Left button, right button, middle button