Complete the code to declare a public class in Unity using C#.
public class [1] : MonoBehaviour {}
In Unity, scripts are classes that usually inherit from MonoBehaviour. The class name should be a valid identifier like PlayerController.
Complete the code to define the Unity method that runs once when the script starts.
void [1]() { Debug.Log("Game started"); }
Start with Update or Awake.The Start method runs once before the first frame update in Unity scripts.
Fix the error in the code to correctly update the position of a GameObject every frame.
void Update() {
transform.position [1] new Vector3(0, 1, 0);
}= replaces the position every frame, causing no movement.Using += adds the vector to the current position each frame, moving the object upward.
Fill both blanks to create a dictionary that maps string keys to integer values in C#.
Dictionary<[1], [2]> scores = new Dictionary<[1], [2]>();
float or bool incorrectly for keys or values.Dictionaries in C# use angle brackets to specify key and value types. Here, keys are strings and values are integers.
Fill all three blanks to create a dictionary comprehension-like initialization with conditions in C#.
var highScores = new Dictionary<[1], [2]> { {"Alice", 95}, {"Bob", 85}, {"Carol", 75} }.Where(kv => kv.Value [3] 80).ToDictionary(kv => kv.Key, kv => kv.Value);
This code creates a dictionary of string keys and int values, then filters to keep only entries with values greater than 80.