1/29
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
What is a "prefab"?
A reusable, saved template of a GameObject (with its components, settings, and children) stored in the Project tab. Dragging it into a scene or calling Instantiate() makes an instance, and editing the prefab updates every instance. Example: the Platform prefab.
What is a "sprite"?
A 2D image asset (usually a .png) that holds only picture data; it has no position, physics, or behavior. It is displayed by a SpriteRenderer component. Examples: Facey.png and Platform.png.
What is the Hierarchy?
The window that lists every GameObject in the currently open scene as a tree. Dragging one object onto another makes it a child. It shows what is in the scene now, unlike the Project tab, which shows all files.
What is a Scene?
A saved file (.unity) holding a set of GameObjects and their settings; effectively one level, menu, or screen of a game. A game can have many scenes (ours is SampleScene), and you must save to keep changes.
What is the difference between the Scene Editor and the Game Window?
The Scene view is where you build and edit the level with a free editor camera, gizmos, and move/rotate/scale tools. The Game view shows the game as the player sees it through the Main Camera. Changes made in Play mode are lost when you stop.
What is the Project tab for?
It shows all asset files in the project's Assets folder (scripts, sprites, prefabs, scenes, materials) and mirrors the folders on disk. You create, organize, and drag assets from here into the scene or Inspector fields.
After we save a resource into Unity, can we move that resource around within the project from File Explorer/Finder? How can we safely move resources around?
No, not safely. Unity tracks each asset with a hidden .meta file holding a unique GUID, and moving outside Unity can break references (missing sprites or scripts). Safely move, rename, or delete assets inside Unity's Project tab so the asset and its .meta file move together.
Once we drag the sprite into the game scene, what does it become, and in what important ways is this different from a sprite?
It becomes a GameObject with a Transform and a SpriteRenderer. A sprite is just an image asset with no position or behavior; a GameObject exists in the scene, has a Transform, and can hold components such as Rigidbody2D, colliders, and scripts. The sprite is only the picture it displays.
What is a Transform?
The component every GameObject has (it cannot be removed) that stores Position, Rotation, and Scale and the parent/child relationships. In code: transform.position, transform.rotation, transform.localScale, transform.Translate().
What does it mean for one GameObject to be the child of another GameObject in terms of its Transform?
The child's Transform values are relative to (local to) the parent, so when the parent moves, rotates, or scales, the child moves with it. Inspector values are local; transform.position is world position and transform.localPosition is relative to the parent. Example: CheckGround is a child of Facey.
What is Start()?
A Unity method that runs once, before the first frame's Update(), only if the script is enabled. It is used for setup such as getting references: rb = GetComponent
What is Update()?
A Unity method that runs once per frame for as long as the script is enabled. It is used for input, movement, and game-state checks that must be done continuously.
What is a RigidBody2D?
A component that puts a GameObject under Unity's 2D physics simulation, giving it gravity, mass, velocity, and responses to forces and collisions. It needs a Collider2D to actually collide. Code: rb.velocity, rb.AddForce(), rb.freezeRotation.
What is the difference between a kinematic and a dynamic RigidBody2D?
Dynamic is fully simulated by physics (affected by gravity, forces, and collisions) and is moved by velocity or forces; Facey is dynamic. Kinematic is not moved by physics (ignores gravity and forces) and is moved by your own code, but it can still push dynamic bodies and detect triggers.
What does GetComponent do, and do you know its syntax?
It retrieves a component of a given type from a GameObject (the same object as the script by default) and returns null if it is missing. Syntax: rb = GetComponent
Is a Vector2 an Object or a Struct?
A struct (a value type) holding two floats, x and y.
For that matter, what is the difference between an Object and a Struct?
An object (class) is a reference type: the variable holds a reference to heap data, assignment copies the reference, it can be null, and it supports inheritance (GameObject, Transform). A struct is a value type: the variable holds the data itself, assignment makes an independent copy, it cannot be null, and it has no class inheritance (Vector2, Vector3, Color, int). That is why transform.position.x = 5 will not compile; assign a whole new vector instead.
What instance variables in our C# scripts appear in the inspector?
public variables, and private variables marked with [SerializeField], as long as the type is serializable (int, float, bool, string, Vector2, GameObject, Transform, components, LayerMask, arrays and lists). Regular private, static, const, and properties do not appear.
What are the benefits of having a variable in the inspector?
You can tweak values without editing or recompiling code, experiment live in Play mode, assign references by drag and drop, use different values on different objects with the same script, let designers adjust the game, and make scripts reusable.
What sorts of methods would we find in the Physics2D class, and why is everything in this class static?
Methods that query or configure the physics world: OverlapCircle, OverlapBox, Raycast, Linecast, CircleCast, BoxCast, IgnoreCollision, IgnoreLayerCollision, plus Physics2D.gravity. They are static because there is only one global physics world per scene, so they belong to the class (Physics2D.Something()) and you never create an instance.
What are layers used for, and how do we create them?
Layers categorize GameObjects so you can filter physics collisions, physics queries (via a LayerMask), and camera rendering. To create one: select an object, open the Layer dropdown in the Inspector, choose Add Layer, name an empty User Layer slot (8 and up), then assign it to objects. Also found at Edit > Project Settings > Tags and Layers.
What is a BoxCollider2D?
A component that gives a GameObject a rectangular collision shape for 2D physics. Properties: Size, Offset, Is Trigger, and Material. Collisions require colliders, and at least one object needs a Rigidbody2D to move.
When would we make a BoxCollider2D a trigger?
When we want to detect something entering an area without physically blocking it, such as pickups, checkpoints, spawn zones, kill zones, and sensors. Example: the Platform prefab has a trigger BoxCollider2D that makes the next platform generate when Facey reaches it.
What does [SerializeField] do?
An attribute placed before a private field that makes Unity serialize it and show it in the Inspector while it stays private in code, keeping encapsulation. Example: [SerializeField] private GameObject _platformPrefab;
What is the difference between Awake(), Start(), and Update(), and in what order are they first called?
Awake() runs first, once, when the script instance loads, and initializes the object's own variables. Start() runs once after all Awakes, just before the first Update (only if enabled), and sets up references to other objects. Update() runs every frame after that. Order: Awake, then Start, then Update.
When is OnTriggerEnter2D called, and what is the parameter Collider2D other for?
It is called when another collider first enters a collider on this object that has Is Trigger checked (at least one object needs a Rigidbody2D). The parameter other is the collider of the other object that entered, so you can identify it with other.gameObject, other.CompareTag(), or other.GetComponent(). The method name must be exact, including the 2D.
Can we call constructors on GameObjects? What do we do instead?
We do not create scene objects or scripts with new. Instead we use Instantiate(prefab), or Instantiate(prefab, position, Quaternion.identity), to clone a prefab, and we do setup in Awake() or Start(). Components are added with AddComponent
What is a Canvas, and how are UI elements such as Text, Panels, and Buttons represented in Unity?
A Canvas is the root container GameObject for all UI. Text, Panels, Buttons, and Images are child GameObjects of a Canvas and use a RectTransform instead of a Transform. A Panel is an Image used as a background, and a Button is an Image plus a Button component with an OnClick event. Create them with GameObject > UI, which also adds an EventSystem.
Does a Canvas use the same Camera as the standard game?
By default no. Screen Space Overlay draws the UI on top of the screen without using any camera. Screen Space Camera uses an assigned camera, and World Space puts the UI in the world to be seen by the normal camera.
How do we write out to the Console?
Debug.Log("message"); also Debug.LogWarning() and Debug.LogError(). Messages appear in the Console window (Window > General > Console). Console.WriteLine does not show in the Unity Console.