What Unity UI component is commonly used to display text in a scene?
TextMeshPro or UI Text
What Unity component is essential for detecting clicks on UI buttons?
Button
What Unity method is used to ensure that a script persists between scenes?
DontDestroyOnLoad()
In Unity, what function is used to generate a random float number between two values?
Random.Range(float min, float max)
What Unity component can make it easier for visually impaired players to navigate menus?
Screen reader support or accessible UI components with text-to-speech features.
Which Unity function is used to load a new scene?
SceneManager.LoadScene()
Which Unity method is used to find all GameObjects with a specific tag?
GameObject.FindObjectsWithTag()
What is the purpose of the Awake() method in Unity?
It initializes data or references before the Start() method is called.
If you want a 25% chance of an event occurring, how would you implement this using Unity?
Use Random.Range(0f, 1f), and check if the result is less than or equal to 0.25f.
How can colorblind players be accommodated in a Unity game?
By using colorblind-friendly palettes and providing alternative visual indicators, such as patterns or symbols.
What is the purpose of SceneManager.GetActiveScene().buildIndex?
It retrieves the build index of the currently active scene.
What does GameObject.SetActive(false) do?
It deactivates the GameObject, making it invisible and stopping any scripts attached to it.
How do you save an integer value in PlayerPrefs?
PlayerPrefs.SetInt("KeyName", value);
How can you simulate a weighted random selection in Unity?
Use an array of weights, calculate cumulative probabilities, and map a random number to a range based on the weights.
What is one way to ensure audio cues are accessible to hearing-impaired players?
Include subtitles or visual cues that correspond to the audio.
Before switching between scenes in Unity, where must they be added for them to load properly?
Scenes must be added to the Build Settings.
How can you pause the game in Unity?
By setting Time.timeScale to 0.
How would you retrieve a high score from PlayerPrefs, with a default value of 0 if it doesn’t exist?
PlayerPrefs.GetInt("HighScore", 0);
How do you use random numbers to create varied enemy spawn points?
Randomly choose a position from an array of predefined spawn locations or use Random.Range() for continuous space.
How can you make controls in a Unity game more accessible?
Allow players to remap controls to suit their needs.
How do you set up a UI button in Unity to call a specific method when clicked?
Assign the button’s OnClick event to the desired method in the Inspector by dragging the GameObject with the script into the event slot and selecting the method.
How can you resume a game after pausing it in Unity?
By setting Time.timeScale back to 1.
Outline a basic algorithm to store the top 5 high scores in a Unity game.
Store scores in a list, sort it in descending order, and keep only the top 5 scores. Save the scores using PlayerPrefs or another persistent method.
Describe a method to ensure fair probability over time (e.g., each item in a loot box has equal chance over many trials).
Use a reservoir sampling or shuffle algorithm to randomly assign probabilities while maintaining fairness.
What is an accessibility feature to consider for players with limited mobility?
Implementing one-button gameplay or adaptive controller support.