User Interface Flashcards

1
Q

Use TextMeshPro instead of Unity GUI Text, as it’s now a Legacy component.
TMP has multiple reasons to be used over GUI Text, including, better control, better rendering, font flexibility, etc.
You will need to install the TMP package with the package manager.
Canvas, TMP, Text and unity may auto prompt you to install the package if you have not already.

A

True

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

Buttons in unity

A

Buttons in unity are use for a variety of reasons, including, scene changes, bring up menus, editing settings, controlling and modify certain aspects of the game Ie, on touch screen, movement and attacking. Accessing a shop and buying items etc.

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

Buttons
A Standard button that can be clicked to trigger an event
Properties include

A

onClick, Unity event that is triggered when the button is pressed
Public methods
OnPointerClick, registered IPointerClickHandler callback
OnSubmit, registered ISubmitHandler callback

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

Inherited members, static properties

AllSelectables, List of all the selectable objects active in the scene

A
Properties
Tag,
Transform
GameObject
Name
Image
Colors
Navigation
hideFlags
spriteState
Transition
TargetGraphic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Button public methods

A
BroadcastMessage
CompareTag
GetComponent
GetComponentInChildren
GetComponentInParent
GetComponents
Invoke
CancelInvoke
SendMessage
isActive
isDestroyed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Button static methods

A

Print. Logs message to the Unity console, identical to Debug.Log
Destroy. Removes a GameObject, component or asset.
DestroyImmediate, destroys the object obj immediately. You are strongly recommended to use destroy instead.
DontDestroyOnLoad. Do not destroy the target object when loading a new scene.
FindObjectOfType. Returns the first active loaded object of Type type.
FindObjectsOfType. Returns a list of all active loaded objects of Type type
Instantiate. Clones the object original and returns the clone.

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

Gizmos
The scene view and the game view both have a gizmos menu
Click the gizmos button in the toolbar of the scene or the game view to access the gizmos menu

A

Gizmos are graphics associated with Game Objects in the scene. Some Gizmos are only drawn when the GameObject is selected, while others are drawn by the editor regardless of which GameObjects are selected

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

Gizmos and Icons

The move, scale, rotate and transform tools are also interactive gizmos

A

You can implement custom Gizmos in your scripts. OnDrawGizmos functions is used for this. You can display icons in the Game view or Scene view. They are flat, billboard style overlaps which you can use to clearly indicate a GameObjects position while you work on your game.
The camera and light gizmos are examples of built in icons, you can also assign your own to GameObjects or individual scripts.

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

Assigning icons to Gizmos

When you change an assets icon, Unity marks the asset as modified, and version control systems register the change.

A

Open the item In an inspector window
Click the select icon button
Choose an icon from the select icon menu.

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

Assign Icons
You can assign custom icons to GameObjects, prefabs, and scripts from the inspector window. Custom icons appear in the Scene view in the same way as default icons for items such as lights and cameras
To control how unity draws custom icons in the scene view, use the Gizmos menu

A

When you assign an icon to a GameObject, the icon appears in the scene view over that GameObject, and any duplicates.
When you assign an icon to a prefab, the icon appears in the scene view over any instances of that prefab.
When you assign an icon to a script, the icon appears in the scene view over any GameObject that has the script attached.

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

To assign a custom icon to a prefab, you must open the prefab in prefab mode.

A

Choose icons from the select icon menu

You assign custom icons from the select icon menu. Top right in the inspector. Can be colors or other.

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

Icon types.

A
  1. Label icons are colored capsules. In the scene view, they display the names of the items they’re assigned to.
    Click on a label to assign it
  2. Image only icons are colored divots. They’re useful when you work with objects that may not have a visual representation. For example, you can assign image only icons to navigate way points so you can see and select them in the scene view
    Click an image only icon to assign it.
  3. Asset icons are image assets in your scene that you use as custom icons. For example, you could use a skull and crossbones icon to indicate danger areas in a game level.
    Click the other button to open an object picker window and select an image asset to assign as an icon.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Toggle Debug Mode

The inspector window is configured as an editor for the selections properties.

A

You can toggle Debug Mode for each inspector window individually
To turn on Debug mode, click the More items button to open the context menu, and select Debug
To return to normal mode change the context menu from Debug to normal

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

Different editors for unity

A
Visual studio code
Project Rider by jetbrains
Atom
Visual studio
MonoDevelop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Layout groups in Unity

A

Grid layout group, grid of objects
Vertical layout group, vertical column of objects of any size
Horizontal layout group, horizontal row of object of any size

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

Slider component Functions in unity
A selectable that controls a fill, a handle, or both.
The fill spans from the minimum to maximum value to the current value, while the handle follows the current value.
The anchors of the fill and handle RectTransforms are driven by the Slider

A

The slider can be edited, the fill can have a solid or gradient color value
The handle can be edited, change the image or deleted altogether
The slider is a UI component

17
Q

Slider component
The anchors of the fill and handle RectTransforms are driven by the Slider.
The fill and handle can be direct children of the GameObject with the slider, or intermediary RectTransforms can be placed in between for additional control

A

When a change to the slider value occurs, a Callback is sent to any registered listeners of Slider.onValueChanged.

18
Q

Slider properties include

A

Direction, from min to max value
FillRect, optional RectTransform to use as a fill for the slider
handleRect. Optional RectTransform to use as a handle for the slider.
Max Value, max allowed value for the slider
Min Value, min allowed value for the slider
NormalizedValue, The current value of the slider Normalized into a value between 0 and 1
OnValueChanged, Callback executed when the value of the slider is changed
Value. The current value of the slider
WholeNumbers. Should the value only be allowed to be whole numbers?

19
Q

Screen Point to ray
Public Ray. ScreenPointToRay(Vector3 pos) ;
Returns a ray going from camera through a screen point
Resulting ray is in world space, starting on the near plane of the camera and going through positions, x and y, pixel coordinates on the screen. Position z is ignored.

A

Parameter
Eye. Optional argument that can be used to specify which eye transform to use. Default is Mono.
Screens pace is defined in pixels. The bottom left of the screen is, 0.0, the top right is, pixel width -1, pixel Height - 1